草庐IT

not_analyzed

全部标签

amazon-web-services - 缺失区域 : could not find region configuration in golang and aws sns

我是Golang和AWS的新手。我正在尝试使用AWSSNS发送短信。我已经设置了环境变量,然后尝试发送短信。exportAWS_ACCESS_KEY_ID=AKIAIOSFODN..exportAWS_SECRET_ACCESS_KEY=wJalrXUtnFEM..exportAWS_DEFAULT_REGION=us-west-2我试图调试我出错的地方但总是报错MissingRegion:找不到区域配置packagemainimport("fmt""github.com/aws/aws-sdk-go/aws""github.com/aws/aws-sdk-go/aws/session

go - 为什么 "gofmt -d"给出 "computing diff: exec: "diff": executable file not found in %PATH%"error on windows?

我想看看我在golang文件中犯了哪些错误。为了弄清楚,我发出这样的命令:gofmt-dmyfile.go根据gofmt--help手册,它应该列出文件的当前版本和所需版本的差异。取而代之的是,它会生成此错误消息:computingdiff:exec:"diff":executablefilenotfoundin%PATH%如何解决这个问题? 最佳答案 gofmt工具假设系统已经安装了可用的diff。遗憾的是,此工具不是标准Windows安装的一部分,因此您需要手动添加它。对于我们大多数人来说,最简单的方法是添加我们计算机上已有的d

go - Confluent Kafka Golang 客户端生产者 "Broker: Not enough in-sync replicas"

我正在尝试测试生产者使用Golang客户端向kafka集群上的主题写入消息。这可以很好地写入本地集群上的主题,我只是复制并粘贴了他们的示例代码githubrepo.packagemainimport("fmt""gopkg.in/confluentinc/confluent-kafka-go.v1/kafka")funcmain(){p,err:=kafka.NewProducer(&kafka.ConfigMap{"bootstrap.servers":"localhost"})iferr!=nil{panic(err)}deferp.Close()//Deliveryreporth

gorename : What is a 'DO NOT EDIT' marker?

我正在使用vscode并尝试重命名变量名称。它没有说:Renamefailed:gorename:cannotrenameidentifiersingeneratedfilecontainingDONOTEDITmarker:/home/adam/go/src/hello/hello.go那么什么是DONOTEDIT标记?为什么它在那里,我怎样才能删除它以便gorename可以做它的事情?我的文件是这样开始的:packagemain//#cgoCFLAGS:-g-Wall//#include//#include"c/greet.h"import"C"import("encoding/j

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 - 错误 "protoc-gen-go: program not found or is not executable"

我正在尝试使用Go构建示例应用程序gRPC,但我无法使用“协议(protocol)”生成代码我已经使用以下方法安装了所需的库和Go包:goget-ugoogle.golang.org/grpcgoget-ugithub.com/golang/protobuf/protoc-gen-go我也试过设置路径,但没有成功。示例“原型(prototype)”文件:syntax="proto3";packagegreet;optiongo_package="greetpb";serviceGreetService{}错误信息:"protoc-gen-go:programnotfoundorisno

templates - Golang 模板.ParseFiles "not a directory"错误

我试图只渲染一个模板:root_path,err:=osext.Executable()iferr!=nil{returnerr}template_path:=root_path+"/app/views/mailtemplates/"+"feedback.html"fmt.Println(exist(template_path))tmpl,err:=template.ParseFiles(template_path)iferr!=nil{returnerr}但是我有错误notadirectory。我的存在函数:funcexist(file_pathstring)bool{if_,err

go - 如何修复这个简单程序中的 'declared but not used' 编译器错误?

我正在努力学习围棋。我真的不明白为什么编译器说我没有使用变量。在我看来,我正在使用该变量作为Println的参数。我的教科书说:Inthisforloopirepresentsthecurrentpositioninthearrayandvalueisthesameasx[i]packagemainimport"fmt"funcmain(){x:=[5]float64{1,2,3,4,5}i:=0vartotalfloat64=0fori,value:=rangex{total+=valuefmt.Println(i,value)}fmt.Println("Average:",tota

time - 戈朗 : throttle (time delay) function is not working in goroutine (works fine in main thread)

所以我正在编写一个实用程序来查询工作中的API,它们将每10秒限制为20次调用。很简单,我会将我的通话时间限制在自上次通话后至少0.5秒。在我尝试使用goroutine之前,我的Throttle实用程序运行良好。现在我正在使用结构/方法组合:func(c*CTKAPI)Throttle(){ifc.Debug{fmt.Println("\t\t\tEnteringThrottle()")}for{//incasesomethingelsemakesacallwhilewe'resleeping,weneedtore-checkift:=time.Now().Sub(c.LastCall

go - Youtube Content ID API 总是返回 Not Found

我的帐户已连接到CMS,但我在API库中看不到YoutubeContentID。但是,我在启用的API中看到了它!!(它出现在我尝试YoutubeContentIDAPI引用文档中的“使用OAuth2.0授权请求”之后)。我可以在引用文档中测试API,它会显示来self的CMS的数据。但是当我从我的程序中调用API时,响应总是这样的:{"error":{"errors":[{"domain":"global","reason":"notFound","message":"NotFound"}],"code":404,"message":"NotFound"}}这是我使用Go实现的:fu