Rapid development of applications based on gin Framework (actual combat type project)

Source: Internet
Author: User
# # # Technology Selection Framework: Gin log Processing: Zaporm:gorm Graceful Restart HTTP service: Gracehttp Test framework: ginkgo### interface Style restful### Project structure * Api-handler function * route-Route Registration * Model-Data model and database operations * DOC-Interface documentation * Log-log processing * config-config file * Tools-Public Tools class * Vendor-project dependent other open source project directory * Dist-Package Build installation package storage path * m Ain.go-Program Execution Portal * Makefile provides script files for compiling, packaging, testing, etc. * Ginkgo binaries, commands to use when executing test cases inside the container, do not remove * junit.xml Test report * Coverprofile.txt A summary of the coverage of the tests passed the # # syntax check make govet### check to see if the official unified standard style made gofmt### build made build### pack made package### Test # # # # # # # # # # # # # # # # # # # # # Network Docker network Create-d Bridge my-net#### executing a test case creating a MySQL container instance consumes 3306, making sure that the port is not being used by another app make Test report Junit.xml and coverage coverprofile.txt files in the corresponding package directory make test includes the following three steps * Remove container, exclude historical test data interference make clean-docker* Start Docker, create a MySQL container instance make start-docker* start executing test case making test-server### test case coverage visualization Go tool cover-html=coverprofile.txt-o Coverprofile.html can clearly see the code covered by the test case and the code that has not been overwritten. # # Management Dependency kit (Vendor tool) Govendor is a management tool ##### install Govendorgo get-u github.com/kardianos/govendor##### command by specifying the package type, you can filter only the specified packages to operate. | Command | function | | -------| --------|| Govendor init | Initialize Vendor Directory | | Govendor List | List all dependent Packages | | Govendor Add | Adding packages to the vendor directory, such as Govendor add +external adding all external packages | | Govendor Add Pkg_path | Add the specified dependency package to the Vendor directory | | Govendor Update | Updates a dependency package from the $GOPATH to the Vendor directory | | Govendor Remove | Dependencies from Vendor Management | | Govendor status | List all missing, expired, and modified packages | | Govendor Fetch | Add or update package to local vendor Directory | | Govendor Sync | Local presence Vendor.json time to pull the dependency package, matching the recorded version | | Govendor Get | Like go get directory, pull dependent package to Vendor directory |### create database* log in as root user MySQL mysql-u root-p* create luckgo user ' Luckgo ' mysq l> create user ' luckgo ' @ '% ' identified by ' Luckgo-password '; Where% means that all machines on the net can be connected, using specific IP addresses more secure point mysql> create user ' Luckgo ' @ ' 0.0.0.0 ' identified by ' Luckgo-password '; * Creating the Critic Database mysql> the Create DB luckgo;* allows the Luckgo user access mysql> grant all privileges the luckgo.* to ' luckgo ' @ '% '; * Exit MySQL mysql> exit # # # Smooth Upgrade KILL-USR2 pid### Application log cutting using the Linux system default installed Logrotate tool in the directory/etc/logrotate.d/ Add configuration file under Luckgo.conf/path/to/log1/path/to/log2 {compress dateext maxage 365 RotatE size = 10M notifempty Missingok Create 644 copytruncate}[Project Address] (HTTPS://GITHUB.COM/KENMYZHANG/LUCKGO) 221 reads  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.