您最多选择25个标签 标签必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

CONTRIBUTING.md 3.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ## Contributing to xorm
  2. `xorm` has a backlog of [pull requests](https://help.github.com/articles/using-pull-requests), but contributions are still very
  3. much welcome. You can help with patch review, submitting bug reports,
  4. or adding new functionality. There is no formal style guide, but
  5. please conform to the style of existing code and general Go formatting
  6. conventions when submitting patches.
  7. * [fork a repo](https://help.github.com/articles/fork-a-repo)
  8. * [creating a pull request ](https://help.github.com/articles/creating-a-pull-request)
  9. ### Language
  10. Since `xorm` is a world-wide open source project, please describe your issues or code changes in English as soon as possible.
  11. ### Sign your codes with comments
  12. ```
  13. // !<you github id>! your comments
  14. e.g.,
  15. // !lunny! this is comments made by lunny
  16. ```
  17. ### Build xorm and test it locally
  18. Once you write some codes on your feature branch, you could build and test locally at first. Just
  19. ```
  20. make build
  21. ```
  22. and
  23. ```
  24. make test
  25. ```
  26. The `make test` is an alias of `make test-sqlite`, it will run the tests on a sqlite database file. No extra thing needed to do except you need to cgo compile enviroment.
  27. If you write a new test method, you could run
  28. ```
  29. make test-sqlite#TestMyNewMethod
  30. ```
  31. that will only run the special test method.
  32. If you want to run another datase, you have to prepare a running database at first, and then, you could
  33. ```
  34. TEST_MYSQL_HOST= TEST_MYSQL_CHARSET= TEST_MYSQL_DBNAME= TEST_MYSQL_USERNAME= TEST_MYSQL_PASSWORD= make test-mysql
  35. ```
  36. or other databases:
  37. ```
  38. TEST_MSSQL_HOST= TEST_MSSQL_DBNAME= TEST_MSSQL_USERNAME= TEST_MSSQL_PASSWORD= make test-mssql
  39. ```
  40. ```
  41. TEST_PGSQL_HOST= TEST_PGSQL_SCHEMA= TEST_PGSQL_DBNAME= TEST_PGSQL_USERNAME= TEST_PGSQL_PASSWORD= make test-postgres
  42. ```
  43. ```
  44. TEST_TIDB_HOST= TEST_TIDB_DBNAME= TEST_TIDB_USERNAME= TEST_TIDB_PASSWORD= make test-tidb
  45. ```
  46. And if your branch is related with cache, you could also enable it via `TEST_CACHE_ENABLE=true`.
  47. ### Patch review
  48. Help review existing open [pull requests](https://help.github.com/articles/using-pull-requests) by commenting on the code or
  49. proposed functionality.
  50. ### Bug reports
  51. We appreciate any bug reports, but especially ones with self-contained
  52. (doesn't depend on code outside of xorm), minimal (can't be simplified
  53. further) test cases. It's especially helpful if you can submit a pull
  54. request with just the failing test case(you can find some example test file like [session_get_test.go](https://gitea.com/xorm/xorm/src/branch/master/session_get_test.go)).
  55. If you implements a new database interface, you maybe need to add a test_<databasename>.sh file.
  56. For example, [mysql_test.go](https://gitea.com/xorm/xorm/src/branch/master/test_mysql.sh)
  57. ### New functionality
  58. There are a number of pending patches for new functionality, so
  59. additional feature patches will take a while to merge. Still, patches
  60. are generally reviewed based on usefulness and complexity in addition
  61. to time-in-queue, so if you have a knockout idea, take a shot. Feel
  62. free to open an issue discussion your proposed patch beforehand.