Guidelines for Compiling Go Plug-ins
Constraint
The Go language has many restrictions on plug-ins, such as the Go version, third-party dependency version, and compilation parameters. The plug-ins must be strictly consistent with the main program of the CodeArts PerfTest executor. Otherwise, exceptions including but not limited to those described in Table 1 may occur. Compile the so file strictly according to the conventions.
Item |
Constraint Value |
Description |
---|---|---|
arch |
linux amd64 |
- |
Go version |
1.19.6 |
Run the go version command to check the version. |
go.mod |
github.com/go-resty/resty/v2 v2.7.0 github.com/shopspring/decimal v1.3.1 github.com/xuri/excelize/v2 v2.6.0 github.com/tidwall/gjson v1.14.4 github.com/valyala/fasthttp v1.43.0 go.uber.org/atomic v1.10.0 golang.org/x/net v0.8.0 golang.org/x/time v0.2.0 |
If a third-party library is directly or indirectly used, use the version according to the constraint value in the go.mod file. If the third-party versions are inconsistent, the following exception occurs: plugin was built with a different version of package github.com/json-iterator/go |
TrimPath |
Using TrimPath |
If this parameter is not used, the following exception occurs: plugin was built with a different version of package internal/unsafeheader Run the Linux command strip to remove symbols and debugging information. |
Compilation Example
go build -buildmode=plugin -trimpath -o random.so random.go strip random.so
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot