草庐IT

directory-walk

全部标签

去安装: no install location for directory

我想我知道发生了什么。当我安装gvm时GOPATH改变了:>alex@alex-K43U:~/go/src/m2k$goinstallgoinstall:noinstall>locationfordirectory/home/alex/go/src/m2koutsideGOPATH>>alex@alex-K43U:~/go/src/m2k$goenv>GOPATH="/home/alex/.gvm/pkgsets/go1.4/global">GOROOT="/home/alex/.gvm/gos/go1.4"我应该知道什么?我担心将GOPATH带到我的工作场所会弄乱gvm。另一方面,g

user-interface - 如何在 Go walk 中设置窗口位置并使其不可调整大小

我正在尝试了解使用GoGUI库的基础知识,walk.首先,我希望能够控制窗口的位置希望采用与其他语言提供的方式类似的方式(屏幕居中、父级居中、精确坐标等)。使窗口不可调整这是我的代码,我希望MaxSize声明可以解决第二个问题,但事实并非如此,我正在寻找某种Position声明,但找不到任何对我有意义的东西。packagemainimport(//"github.com/lxn/walk"."github.com/lxn/walk/declarative")funcmain(){MainWindow{Title:"Test",MinSize:Size{300,50},MaxSize:S

deployment - Golang 执行 : stat: no such file or directory after file has been moved there

我有一个脚本,用于使用“os/exec”包进行部署。我使用的命令之一如下:cpInit=exec.Command("cp","initScripts/nginx","/etc/init.d/nginx")还有一个:startNginx=exec.Command("/etc/init.d/nginx","start")最初我使用err:=cpInit.Run()运行第一个命令,但后来当我运行第二个命令时出现错误:exec:"/etc/init.d/nginx":stat/etc/init.d/nginx:nosuchfileordirectory但是当程序退出时/etc/init.d/n

go - 解析球 : What is the pattern to parse all templates recursively within a directory?

Template.ParseGlob("*.html")//fetchesallhtmlfilesfromcurrentdirectory.Template.ParseGlob("**/*.html")//Seemstoonlyfetchatoneleveldepth我不是在寻找“步行”解决方案。只是想知道这是否可能。我不太明白这是什么“模式”。如果我能得到有关ParseGlob使用的模式的解释,那也很棒。 最佳答案 codetext/template/helper.go提及//Thepatternisprocessedbyfile

go - Go 编译器的 "no such file or directory"是什么意思?

我正在尝试编译一个由多个模块组成的Go程序,如下所示://main.gopackagemainimport"mst"//dosomethinginterestinginvolvingminimumspanningtrees//src/mst/kruskal.goimport"disjsets"//Kruskal'salgorithmfollows//src/disjsets/disjsets.go//implementsdisjointsetswithunion-find现在,当我在包含exportGOPATH=.的目录中运行gorunmain.go或gobuild时>main.go和

directory - Go语言如何检查zip入口是否为目录

我猜以下结构中的某些部分将文件标记为目录。但我找不到相关引用。http://golang.org/pkg/archive/zip/#FileHeader 最佳答案 压缩包的FileHeader您链接到的类型有一个.FileInfo()返回os.FileInfo的方法类型,它本身有一个.IsDir()方法。因此将它们链接在一起,您可以判断zip存档中的文件是否是包含f.FileInfo().IsDir()的目录。例子:packagemainimport("archive/zip""fmt")funcmain(){//Openazipa

go - 无法运行 go install : no install location for directory outside GOPATH

当我尝试运行goinstall时,我得到以下信息:goinstallgolang-book/chapter11/math:mkdir/Users/Swanros/Go/pkg/darwin_amd64:permissiondenied然后我尝试sudogoinstall并获得以下内容:goinstall:noinstalllocationfordirectory/Users/Swanros/Go/src/golang-book/chapter11/mathoutsideGOPATH这是我的goenv:GOARCH="amd64"GOBIN=""GOCHAR="6"GOEXE=""GOH

android - 构建 android-go "stdlib.h: No such file or directory"

我正在尝试使用../build-android.sh在ubuntu16中构建一个android-go示例,但出现错误,#runtime/cgo_cgo_export.c:2:20:fatalerror:stdlib.h:Nosuchfileordirectory#include^https://github.com/xlab/android-go/tree/master/examples/minimal有人有什么建议吗?我已经仔细检查了lib6c头库。完整的构建日志是../build-android.sh+:26+:/home/jsper/Downloads+:/home/jsper/

戈朗 : Parse all templates in directory and subdirectories?

这是我的目录结构:app/template/layout/base.tmplindex.tmpltemplate.ParseGlob("*/*.tmpl")解析index.tmpl但不解析中的base.tmpllayout子目录。有没有办法递归解析所有模板? 最佳答案 不是没有实现你自己的功能来做到这一点,我一直在使用这样的东西funcParseTemplates()*template.Template{templ:=template.New("")err:=filepath.Walk("./views",func(pathstri

go - filepath.Walk() - 我可以提供关于哪些目录不能行走的规则吗?

我正在使用Go1.7rc1编写GoLang应用程序。现在我想找到特定路径下的所有go文件。除此之外,我不想在某些目录上行走..例如..隐藏目录,如.git。有没有办法为Walk()提供一些规则?或者..是否有不同的库提供这些功能?现在这是我的代码:funcvisit(pathstring,fos.FileInfo,errerror)error{fmt.Printf("Visited:%s\n",path)returnnil}funcmain(){filepath.Walk(path,visit)}如有任何有关此问题的信息,我们将不胜感激。谢谢! 最佳答案