- make it correct (make it work)
- make it readable (refactor code for better orientation, easy to understand)
- make it small (reduce number of code lines)
- make it simple (change code to make it more beautiful, easier to read and understand)
- make it fast (change algorithm, use benchmarks, make tests)
https://dave.cheney.net/practical-go/presentations/qcon-china.html#_package_design
- Files should be maximal 1000 lines long, optimal below 500 lines.
- Reduce communication with expensive things (like databases) to minimum.
- Make code readable, it should read like an english book.
- Comment are forbidden, use logging instead.
- Always use main.go as a starting point for every software. Use default go coding conventions.
- Handle errors first. Use switch instead of multiples if-else.
- Every procedure, method or functions starts with logging message and ends with logging messages with result and elapsed time information.
- Software naming is lower case only with underscore.
- First name is the name of the software.
- Second name is the type.
- _service is for software that does NOT have web
- _webservice is for software that DOES have web
- _communication is added for softwares that transfer data with another systems
Examples:
- zapsi_service
- state_service
- terminal_service
- display_webservice
- terminal_webservice
- lcd_webservice
- maplast_communication_service
- database
- ...
- File naming is lower case one name only.
Examples:
- config.go
- main.go
- log.go
- If there are multiple files that bound together, use the same name.
- input_user.go
- input_user.html
- input_user.css
- input_user.js
- Variable naming is camelCase, reasonable name should be used.
- Use reasonable and descriptive name
Examples: runningDevices instead of rd, runDev, ...
- Only one branch is allowed.
- Only one user can work on one software at a time.
- All users have admin rights.
- Every user is responsible for his or her work.
- First create repository on Github
- Then pull repository to Goland and make changes
- Send information about start working on specific software to messages
- Always first pull (update) from github
- Make changes
- Update changelog.md
- Commit and push changes
- Send information about end working on specific software to messages
- All users are responsible for adding new issues for all repositories, when requested
- All users are responsible for checking periodically all issues and assigning their work on those issues
- All users are responsible for managing issues states
- All users are responsible for closing done issues
- All users are responsible for managing proper dashboard issues in project page
- Commit after every change.
- commit after every major change
- use imperative way
Bad: fixed stuff
Good: Fix issue where user session does not expire
- Update changelog.md at the end of the day, use these tags:
Added
for new features.Changed
for changes in existing functionality.Deprecated
for soon-to-be removed features.Removed
for now removed features.Fixed
for any bug fixes.Security
in case of vulnerabilities.
- Main language: Go
- Additional languages: HTML, CSS., JavaScript
- ORM: GORM
- Http Router and Muxer: Gin
- Main Javascript Charting Library: Echarts
- Main database: PostgreSQL
- Runtime: Docker
- Git repository: Github
- Licence: MIT
Version contains year, quarter, month of the quarter and day of the month.
2019.2.1.24 is version from year 2019, second quarter, first month of second quarter, which is April, and from 24th of April.
Every week build new "latest" and proper "2019.2.1.24" version
- Only petrjahoda is allowed to push new and updated dockerhub images
- All dockerhub images are public