草庐IT

apache_get_modules

全部标签

json - 如何从 http.Get 获取 JSON 响应

我正在尝试从Web读取JSON数据,但该代码返回空结果。我不确定我在这里做错了什么。packagemainimport"os"import"fmt"import"net/http"import"io/ioutil"import"encoding/json"typeTracksstruct{Toptracks[]Toptracks_info}typeToptracks_infostruct{Track[]Track_infoAttr[]Attr_info}typeTrack_infostruct{NamestringDurationstringListenersstringMbidstr

regex - 使用正则表达式解析 Apache 日志文件

这个问题在这里已经有了答案:SplitastringonwhitespaceinGo?(4个答案)关闭3年前。我正在解析一个我自定义的Apache日志,它只给我两个值:“time”和“memory”(值是毫秒数和字节数),它们都是int64或float64,但我是使用正则表达式和Go来解析文件,所以当我匹配文件的内容时,它返回“[]”(空括号)并且不填充slice,我的代码是:for_,line:=rangelines{varbufferbytes.Bufferbuffer.WriteString(`\[0-9]+\s`)buffer.WriteString(`[0-9]+\s`)re

http - 为什么 "http.Get()"方法在 go 中抛出致命异常?

我正在尝试使用以下方法:response,err:=http.Get("https://support.microsoft.com")它按预期工作。但是当我用"https://samsung.com"调用它时,它抛出了我无法处理的致命异常。代码示例:packagemainimport("fmt""net/http")funcmain(){_,err:=http.Get("http://support.microsoft.com")iferr!=nil{fmt.Println(err)}}这里是错误:panic:cipher.NewCBCEncrypter:IVlengthmustequ

go - 使用 GO111MODULE=on 安装 augustoroman/v8 时遇到问题

我能够完成设置和安装github.com/augustoroman/v8的整个过程——我手动构建了它的V8依赖项。当我运行gotest时,我得到以下结果:PASSokgithub.com/augustoroman/v89.433s我在$GOPATH/src/github.com/augustoroman/v8安装了这个包。到目前为止,一切似乎都在OSX上运行良好。但是,当我尝试在我自己的单独项目中使用import"github.com/augustoroman/v8"导入时,我收到了投诉。回想起来,我意识到我启用了GO111MODULE=on。这促使我在v8文件夹的根目录中添加一个包含

docker - go get golang-migrate inside of docker 错误

我正在尝试使用Docker在go中设置一个小型的首次应用程序。我想使用cli工具进行go-lang迁移。但是我收到以下错误:packagegithub.com/golang-migrate/migrate/v4/internal/cli:在以下任何一个中找不到包“github.com/golang-migrate/migrate/v4/internal/cli”:/usr/local/go/src/github.com/golang-migrate/migrate/v4/internal/cli(来自$GOROOT)/go/src/github.com/golang-migrate/m

Go Modules - 如何引用 GitHub 中的分支

我正在使用CoreosOIDClibrary并且想知道如何引用(在go.mod文件中)一个分支,因为它们不是在master下开发的,而是使用v2相反。我试过github.com/coreos/go-oidc@v2但我得到:go:github.com/coreos/go-oidc@v2@v2.0.0+incompatible:invalidgithub.com/importpath"github.com/coreos/go-oidc@v2"go:errorloadingmodulerequirements 最佳答案 错误消息中的短语i

java - 带有数据流的 Apache Beam Go SDK

我一直在使用GoBeamSDK(v2.13.0),但无法获得wordcountexample致力于GCP数据流。它进入崩溃循环以尝试启动org.apache.beam.runners.dataflow.worker.DataflowRunnerHarness。该示例在使用Directrunner在本地运行时正确执行。该示例与上面给出的原始示例完全没有修改。堆栈跟踪是:org.apache.beam.vendor.grpc.v1p13p1.com.google.protobuf.InvalidProtocolBufferException:Protocolmessagehadinvali

go - Firestore 云函数 : Get DocumentSnapshot from the event

我正在监听收集文档的更改事件,只是转储我收到的内容:funcForwardUserChanged(ctxcontext.Context,ecloudfn.FirestoreEvent)error{raw,err:=json.Marshal(e.Value.Fields)iferr!=nil{returnerr}fmt.Println(string(raw))returnnil}其中FirestoreEvent是自定义结构://FirestoreEventisthepayloadofaFirestoreevent.typeFirestoreEventstruct{OldValueFire

go - 在 buffalo 中生成新项目失败,出现 GO111MODULE 问题

我是第一次尝试buffalo。我手动安装了先决条件而不是使用scoop,因为我不知道scoop会把东西放在哪里:https://www.stuartellis.name/articles/windows-golang-setup/#installing-buffalo使用Powershell中的这个安装了buffalo,它似乎工作正常:goget-u-vgithub.com/gobuffalo/buffalo/buffalo然而,当我使用这个例子生成一个新项目时:https://gobuffalo.io/en/docs/getting-started/new-project/buffa

go - 构建命令行参数 : cannot load local package: cannot find module providing package

我无法使用gomod加载本地包。我有单独的go.mod文件用于repoA和repoB。我在任何地方都找不到解决方案。操作系统是windows。$>goversiongoversiongo1.12.7windows/amd64当我从repoA运行主文件时,我有两个带有存储库的模块。它将尝试查找repoB的模块/包,然后抛出一个错误提示cannotfindmoduleprovidingpackage我的repo结构:-����repoA�����proto������system�����sauth�����shandle�����smodel�����sresponse����repoB