草庐IT

ubuntu-base

全部标签

ubuntu - 如何设置具体的GOPATH?

我的go安装了ubuntu包。基础库(fmt等)工作正常。但我在/var/www/mygoproject中有一个包含多个子文件夹的真实项目ex:./子文件夹1./lib1./lib2./子文件夹2subfolderX包含不同的go应用程序,libX包含共享代码。我想在subfolderX中使用导入“lib1/包内”但我总是收到importedandnotused错误。我必须做什么?编辑:/var/www/project/subproject/folder/alpha.go代码packagemainimport("subprojectA/folder/apackage"//doesntw

xml - 在go中将数组编码为base64

这是我开发的功能的完整代码:packagemainimport("database/sql""log""encoding/xml""github.com/gin-gonic/gin"//golangframeworks_"github.com/go-sql-driver/mysql""gopkg.in/gorp.v1"//workwithdatabase(mysql,etc.))typeGenrestruct{Titlestring`xml:"genre"`}typeGenreArraystruct{Auth_stateint`xml:"auth_state"`Countint64`x

ubuntu - 我无法在 Ubuntu 上同时安装 golang 和 godoc

我使用sudoapt-getinstallgolang安装了golang。然后我可以使用go命令。但是没有godoc命令。我在网上发现我可以使用sudoapt-getinstallgolang-go.tools来安装godoc。当我这样做时,我可以使用godoc命令,但go命令不再起作用。如何让它们同时工作? 最佳答案 好吧,我的第一个建议是尝试删除golang-go.tools包,然后尝试gogetgolang.org/x/tools/godoc;看看是否可行。除此之外,添加更多详细信息会有所帮助。当您现在尝试运行go命令时遇到什

image - Go - 将 base64 字符串保存到文件

所以..我有一个base64编码的字符串,我需要对其进行解码,检查它的宽度和高度,然后保存到文件中。然而..我一直在保存损坏的图像文件。packageserverimport("encoding/base64""errors""io""os""strings""image"_"image/gif"_"image/jpeg"_"image/png")var(ErrBucket=errors.New("Invalidbucket!")ErrSize=errors.New("Invalidsize!")ErrInvalidImage=errors.New("Invalidimage!"))f

ubuntu - "go get collidermain"时 golang.org/x/net/websocket 出错 --- 在 Ubuntu 14.04 服务器上部署 AppRTC

我一直在尝试将AppRTC部署到我学校的Ubuntu服务器上,但无济于事。我已按照Collider上的说明进行操作直到命令“gogetcollidermain”返回错误如下:#golang.org/x/net/websocketgoWorkspace/src/golang.org/x/net/websocket/dial.go:18:19:error:referencetoundefinedidentifier‘tls.DialWithDialer’conn,err=tls.DialWithDialer(dialer,"tcp",parseAuthority(config.Locati

ubuntu - 在 Docker 容器 (Ubuntu) 中运行在 Windows 中创建的 Go 应用程序

我创建了一个非常简单的应用程序来输出一些文本。我的开发环境是Windows+DockerforWindows。我创建了ubuntu容器,并在Windows中为ubuntu构建了我的应用程序setGOARCH=amd64setGOOS=linuxgobuild-o"myapp"然后我将“myapp”文件复制到共享文件夹,并在我的容器的共享文件夹中看到它。在我尝试在容器中运行它但出现错误之后为什么我不能运行它?它是构建不正确还是我尝试以某种错误的方式执行它?在Windows中,当我运行我的exe文件时我有这个输出,我想要在Ubuntu中有相同的东西。更新按照建议,我尝试./myapp并且出

linux - 用于在 Ubuntu 16.04 上更新 GO 项目的 Bash 脚本

这个问题在这里已经有了答案:HowtogetprocessIDofbackgroundprocess?(9个回答)关闭5年前。伙计们。我是bash脚本编写和在ubuntu上部署Go的新手。我这样运行我的Go程序gobuild-omyprogrammain.go./myprogram&但现在,我不想使用sftp上传文件并手动更改所有内容,而是编写简单的bash脚本。问题是我首先需要终止现有进程,但我不知道如何获取PID并终止它。也许我可以使用不同的东西运行我的程序,这样我就不必找到PID。我尝试使用psax|grepmyprogram然后杀死它,但没有成功

templates - {{template "base"}} 和 {{template "base".}} 在 go-gin 中的区别

{{template"base"}}和{{template"base".}}有什么区别?我用的是go-gin,两者都可以正常运行。我在文档中找不到关于此的任何描述。 最佳答案 来自godoctext/template:{{template"name"}}Thetemplatewiththespecifiednameisexecutedwithnildata.{{template"name"pipeline}}Thetemplatewiththespecifiednameisexecutedwithdotsettothevalueof

ubuntu - 在 ubuntu 上使用官方存档安装 go-vim 后无法正常工作

使用官方存档安装go:https://golang.org/doc/install?download=go1.10.1.linux-amd64.tar.gz提取它:$tar-C/usr/local-xzfgo1.10.1.linux-amd64.tar.gz检查go版本:$goversiongoversiongo1.10linux/amd64使用vim-go作为一个vim插件,当使用vim打开一个go文件时,它说:vim-go:couldnotfind'gotags'.Run:GoInstallBinariestofixit因此,当运行:GoInstallBinaries时,得到消息:

go - 如何访问 Structs 内部的 map ?不能获取 g.vertexes[base] 的地址

考虑以下问题。我有两个结构,Graph和Vertexpackagemainimport("github.com/shopspring/decimal")typeGraphstruct{vertexesmap[string]Vertex}typeVertexstruct{keystringedgesmap[string]decimal.Decimal}和Vertex的引用接收器func(v*Vertex)Edge(tstring,wdecimal.Decimal){v.edges[t]=w}我想在不同时间更新Graph结构内Vertex.edges映射的值。我最初尝试了这段来自Pytho