草庐IT

build-time

全部标签

docker - 去构建 : build output "api" already exists and is a directory

我正在尝试使用CompileDaemon热重载使用Docker的go项目。我的文件夹结构如下所示my-api-server-main.go-Dockerfile-docker-compose.yml-Makefile这是我得到的错误:gobuildgithub.com/firstApi/test-platform/lib/my-api/server:构建输出“server”已经存在并且是一个目录这是我的dockerfile的样子FROMgolang:1.12-stretchENVGO111MODULE=onWORKDIR/go/srcCOPYgo.mod.COPYgo.sum.RUNg

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 - 如何在 DataStore 中存储 *time.Time 类型的结构字段的当前时间?

这个问题在这里已经有了答案:Assignvaluereturnedfromfunctiontopointer(1个回答)关闭3年前。根据我的要求,我创建了一个结构为-typeMyRulestruct{CreatedAttime.Time`json:"createdAt"datastore:"createdAt,noindex"`UpdatedAt*time.Time`json:"updatedAt"datastore:"updatedAt,noindex"`}对于createdAt字段,我可以将当​​前时间存储为-MyRule.CreatedAt=time.Now()但是,将当前时间存

go - 为什么我的程序在添加 time.sleep 时挂起?

我正在尝试对我的程序进行测试,该程序将在设定的时间间隔内保存到磁盘。我的问题是当我添加time.Sleep测试时,无论持续时间如何,程序都会挂起。我的预期行为是我允许它休眠,并且go例程应该在后台运行并保存到磁盘上。这是作为测试中的goroutine运行的相关函数。节点服务.gofuncrunRegistryBackup(reg*NodeRegistry,intervalint,killchanchanbool){log.SetPrefix("[RegistryBackup]\t")log.Printf("Intializingbackupevery%dseconds",interva

linux - Go 导致 OpenGL 与 time.Tick 但不是 time.After 发生段错误

我有以下两个文件:bridge.go:packagecube//#cgoLDFLAGS:-lGL-lGLEW-lglfw//#include//intinit(GLFWwindow**);//voidrender(GLFWwindow*);import"C"import("fmt""time")funcInit(){varwindow*_Ctype_GLFWwindowwindowWat:=(*[0]byte)(window)fmt.Printf("Callinginit\n")ifC.init(&windowWat)!=1{return}window=(*_Ctype_GLFWwin

Go语言: Change the build folder when running "go run"

在Windows上使用Go,每当我从控制台执行gorunmyprog.go时,Go都会在我的C盘某处构建一个具有随机名称的新可执行文件。有没有办法配置它,使其始终将文件构建到特定位置,最好也避免名称的随机性?(即,始终构建到D:\Temp\LastBuild.exe)。我能够找到一些在执行gohelprun和gohelpbuild时没有帮助的信息。后者有一个输出标志-ooutfile但它在gorun中不被接受。感谢任何帮助。 最佳答案 不要使用gorun。它旨在快速测试单屏行大小的代码片段。工作方式是编辑代码。去构建它。运行您的可执

go - Q : Getting Build Error "Invalid Import Path"

我坚持使用它说的“beerun”来运行BeeGO应用程序问题是我已经正确设置了我的GOPATH到D:/WebDev/GO/BeeGO/test-project/并且路由器路径确实存在,我已尝试手动构建文件,但它不会生成.exe文件。有人知道如何解决这个问题吗?我使用的是Windows8.1Pro(64位)谢谢 最佳答案 GO期望$GOPATH下的目录结构按照codeorganization中描述的以下方式:$GOPATH/src与其将源文件直接放在$GOPATH下(D:/WebDev/GO/BeeGO/test-project/对于

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

linux - 为什么 'go build file.go' 在我的本地终端上工作正常,但通过 SSH 给我一个错误?

当我在本地终端(ubuntu上的Konsole)运行“gobuildfile.go”(或“goinstall”)时,我的代码构建正确,没有任何警告。但是,当我通过SSH(从另一个Linux机器或从Windows使用PuTTY)连接到完全相同的机器时,我收到警告消息:warning:GOPATHsettoGOROOT(/home/[username]/go)hasnoeffectgobuildruntime:linux/amd64mustbebootstrappedusingmake.bash在终端中:'go版本'报告go1.3.3linux/amd64'whichgo'报告/usr/l

go - 如何遍历 go time.Tick channel ?

我在使用time.Tick时遇到困难。我希望这段代码打印“hi”10次,然后在1秒后退出,但它挂起了:ticker:=time.NewTicker(100*time.Millisecond)time.AfterFunc(time.Second,func(){ticker.Stop()})for_=rangeticker.C{gofmt.Println("hi")}https://play.golang.org/p/1p6-ViSvma查看source,我看到调用Stop()时channel没有关闭。在那种情况下,遍历代码channel的惯用方法是什么? 最佳