Updated on 2023-10-23 GMT+08:00

Go Code Project Structure

Currently, online import is not supported. You need to place the decompressed Go driver source code package in the local project. The driver code is managed based on go mod. GO111MODULE needs to be set to auto or on. When go build or go run is executed, the related driver dependency is parsed and downloaded. Currently, GOPROXY=http://cmc.centralrepo.rnd.huawei.com/go,http://mirrors.tools.huawei.com/goproxy can be set for Huawei internal users. Set GOPROXY=https://goproxy.io,direct for external users.

Currently, Huawei's memory dependency repository is under HTTPS reconstruction. In the future, the setting can be changed to GOPROXY=https://cmc.centralrepo.rnd.huawei.com/go,https://mirrors.tools.huawei.com/goproxy.

The go mod development project is as follows:

-go

----pkg

----src

-------gitee.com

----------opengauss

-------------openGauss-connector-go-pq

-------Huawei_servicexx.com

----------xx_core_service

----------xx_other

----------go.mod

You need to set GOPATH to ${Directory where Go is located} and add the following content to go.mod:

replace gitee.com/opengauss/openGauss-connector-go-pq => ../gitee.com/opengauss/openGauss-connector-go-pq

The preceding information indicates that all gitee.com/opengauss/openGauss-connector-go-pq in the code is imported locally and the dependency is not downloaded from the proxy.

If you do not want to reconstruct the go mod project, set GO111MODULE to off and manually download the dependency packages xerrors and pbkdf2 to the directory specified by ${GOPATH} which is at the same level as the driver root directory and service code.