可能是显而易见的事情,我正在 OSX 上构建尝试构建 Linux 二进制文件,相同的命令适用于另一个项目,但是:
GOOS=darwin GOARCH=amd64 go build -v gitlab.com/project/project-data-convertor
Run Code Online (Sandbox Code Playgroud)
返回没有错误
GOOS=linux GOARCH=amd64 go build -v gitlab.com/project/project-data-convertor
gitlab.com/project/project-data-convertor
# gitlab.com/project/project-data-convertor
./utils.go:253:50: undefined: beamLocation
./utils.go:278:36: undefined: beamLocation
./utils.go:278:50: undefined: beamLocations
./utils.go:278:50: too many errors
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建对现有代码的 Go Swagger 响应,而不更改其中的大部分代码,目前我有:
// DataExpressionInput - only public so we can use it embedded in dataExpression
// swagger:model
type DataExpressionInput struct {
Name string `json:"name"`
Expression string `json:"expression"`
Type expressionType `json:"type"`
Comments string `json:"comments"`
Tags []string `json:"tags"`
}
// swagger:model dataExpressionModel
type DataExpression struct {
// The main data expression information
//
// Required: true
*DataExpressionInput
// Additional metadata
*pixlUser.APIObjectItem
}
//swagger:response dataExpressionLookup
type DataExpressionLookup map[string]DataExpression
Run Code Online (Sandbox Code Playgroud)
我试图通过 API 返回 dataExpressionLookup 对象,但是当我导出 swagger 定义时,我得到:
"definitions": {
"DataExpressionInput": {
"description": "DataExpressionInput …Run Code Online (Sandbox Code Playgroud)