Golang Language Recognition Method
go.mod file exists in the root directory of the source code and the
Dockerfile file does not exist, Kato will recognize the source code as a
- After the pre-compilation process is completed, the
Golangwill be selected according to the language type to compile the project. The defined
Golangversion will be installed during the compilation process;
- After the compilation is completed, it will be checked whether the
Procfileparameter is set on the platform. If it is configured, it will rewrite the startup command configuration file Procfile.
Golang Project Source Code Specification
In this step, you need to provide a usable Go source code program for deployment on the Kato platform. This application must at least meet the following conditions:
go runthat can run normally locally.
The source code program must be hosted on related git or svn services such as gitlab.
Compile the Specified Module
If there are multiple services in the current project, they can be compiled into multiple binaries, or the main file is not in the main code directory. In golang, a service is usually packaged under the cmd path. At this time, it cannot compile and run correctly according to the above method.
BUILD_GO_INSTALL_PACKAGE_SPEC variable to the environment variable to define the entry path of the component compilation package, for example:
gridworkz.com/app-store is the main name of the project, which is consistent with the
module in go.mod.
/cmd/manage-server is the package path where the main entry code of the current component relative to the code main directory is located.
The startup command must be defined by uploading the
Procfile file under the code root directory or declaring the environment variable
BUILD_PROCFILE, the format is as follows:
- There is a space between
- The end of the file cannot contain special characters
hellois the compiled binary
For the project compiled by the specified module, the following definitions should be made:
manage-server is the path of the service subdirectory under the default cmd directory. The binary files are stored in the bin directory.
Compile and Run Environment Settings
Configure Golang Version
The mainstream supported versions are
go1.11.2, and the default version of Cloud Help is
#Support version Go1.9.7 go1.8.7 go1.11.2 go1.11 go1.11.1 go1.10.5 go1.10.4
Go Tools Version
- Dep Version v0.4.1 is supported by default
- Glide Default support version v0.12.3
- Govendor Version v1.0.8 is supported by default
- GB Version 0.4.4 is supported by default
- PkgErrors Version 0.8.0 is supported by default
- HG Version 3.9 is supported by default
- TQ Default support version v0.5
- MattesMigrate Version v3.0.0 is supported by default