草庐IT

fields-for

全部标签

azure - 更新 azure-sdk-for-go 库依赖项

执行此任务的最佳做法是什么?到目前为止我尝试过的,只需运行命令depensure-updategithub.com/Azure/azure-sdk-for-go引发了以下错误:Warning:thefollowingproject(s)have[[constraint]]stanzasinGopkg.toml:✗github.com/gravitational/trace.....depensure给我与dep-update命令类似的错误。depcheck给出以下输出:#Gopkg.lockisoutofsync:github.com/Azure/azure-sdk-for-go/ar

arrays - 如何在golang中使用for循环将值存储在结构中

我想将值存储在结构中。我有多个数据集,在迭代这些数据集时,我必须将这些数据集存储到结构中。我还应该拥有以前存储的数据以及当前存储的数据。请找到我正在使用的代码packagemainimport("fmt")typesaveDetailsstruct{IDstringGradestringRegularstringOpeningKeystring}funcmain(){tagsList:=[]saveDetails{}results=[{{1000000001ARegularJOBOp123}}{{1000000002BRegularJOBOp234}}{{1000000003CRegu

go - 限制 VS Code for Go 仅下载 v 1.11 的包

我正在使用VisualStudioCode1.33.1版作为我们的Go应用程序的IDE。我们想为我们的应用程序使用Go版本1.11。但是看起来我们正在使用的一个或多个依赖项已经为Go1.12下载了一个包。现在,VSCode无法构建应用程序并出现以下错误:gobuildgolang.org/x/sys/unix:modulerequiresGo1.12gobuildgithub.com/pelletier/go-toml:modulerequiresGo1.12go[1,1]我尝试重新安装Go1.11,删除有问题的软件包并让它重新安装。无论我何时尝试构建VSCode,下载1.12版本都无

go - 未定义 : SQLiteConn when trying to build go app for armv7

我必须为UbuntuARM-v7编译一个Go服务当我编译它时GOARCH=armGOARM=7gobuild-v-orelease/edge_to_bc-ldflags'-s-w-extldflags"-static"'./...我得到:gitlab.com/company/edge_to_bc/vendor/github.com/hyperledger/fabric/bccsp/pkcs11#gitlab.com/company/edge_to_bc/vendor/github.com/hyperledger/fabric/bccsp/pkcs11vendor/github.com/

go - 如何修复 VS Code 错误 : "Not able to determine import path of current package by using cwd" for Go project

我正在学习教程,我想我可能错过了一些东西。我有一个Go项目位于:/Users/just_me/development/testing/golang/example_server内容是:main.gopackagemainimport"fmt"funcmain(){fmt.Println("hiworld")}我有一个~/go目录。goenv显示:GOPATH="/Users/just_me/go"GOROOT="/usr/local/Cellar/go/1.12.9/libexec"我在VSCode中安装了建议的包。当我保存我的main.go时,我得到:Notabletodetermi

go - 如何在 GoLang 的命令行上取消设置标志 Visited for Tests

我正在尝试运行每次使用不同参数多次调用同一函数的测试。这是一个接受不同命令行标志的应用程序。如果未提供命令行标志,则使用默认值。flagset=make(map[string]bool)flagset["flag1"]=falseflagset["flag2"]=falseflagset["flag3"]=falseflagset["flag4"]=falsefuncLoadCommandLineArguments(args[]string)error{err:=flag.CommandLine.Parse(args)/*Doerrorhandling*/flag.Visit(func

for-loop - GO:使用for循环添加到 map

关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion我一直在尝试使用golang中的for循环添加到map,但我一直无法这样做。谁能举一个简单的例子说明如何做到这一点?谢谢!

json - Golang & mgo : How to create a generic entity with common fields like _id, 创建时间,最后更新

给定以下结构:packagemodelsimport("time""gopkg.in/mgo.v2/bson")typeUserstruct{Idbson.ObjectId`json:"id"bson:"_id"`Namestring`json:"name"bson:"name"`BirthDatetime.Time`json:"birth_date"bson:"birth_date"`InsertedAttime.Time`json:"inserted_at"bson:"inserted_at"`LastUpdatetime.Time`json:"last_update"bson:"

python - Elasticsearch - field_value_factor,缺少参数

所以我终于设置了elasticsearch数据库并将数据导入其中。有时当我尝试从前端请求数据时,我会收到500错误(并非总是如此,只是有时)。我尝试从POSTMAN请求数据(以查看ES错误消息)。我得到了:{"error":"SearchPhaseExecutionException[Failedtoexecutephase[query],allshardsfailed;shardFailures{[9m4uVcf3TLmQ9Kr7z_fSpQ][text][0]:QueryPhaseExecutionException[[text][0]:query[filtered(functio

去建立错误 "db.GetUsers undefined (type *gorm.DB has no field or method GetUsers)"

我是golang的新手,正在尝试使用gin+gorm制作API服务器。我尝试构建下面的代码,但出现了type*gorm.DBhasnofieldormethodGetUsers错误。这是一个非常简单的API服务器,我只想从users表中获取所有用户。packagemodelsimport("github.com/jinzhu/gorm"_"github.com/jinzhu/gorm/dialects/postgres")vardb*gorm.DBfuncinit(){varerrerrordb,err=gorm.Open("postgres","host=localhostdbnam