goapp fmt源代码目录

huangapple go评论69阅读模式
英文:

goapp fmt source code directory

问题

在遵循Google App平台网站上关于golang的示例时,我发现它建议将源文件直接放入应用程序文件夹的子文件夹中,例如:

app/
  hello/
    hello.go
  app.yaml

我可以使用goapp serve app启动应用程序。

但是我无法格式化源代码。我最初的猜测是goapp fmt app - 失败。我也无法构建应用程序:goapp build app

无法加载包:包app:在以下任何位置都找不到包“app”:
         ....
         ....

尝试使用GOPATH:

GOPATH=`pwd`/app goapp build

也没有多大意义

无法加载包:包。:在/....中没有可构建的Go源文件

我还担心安装包可能会很麻烦,除非我找到了正确的位置来启动它们或正确配置了GOPATH。对于Google App Engine Go应用程序,你有什么想法?

英文:

While following the example for golang on Google App Platform website I've found that it recommends to put the source files straight into the subfolder of the application folder, e.g.

app/
  hello/
    hello.go
  app.yaml

I can start the app with goapp serve app.

But I cannot format the source code. My first guess was goapp fmt app - fail. I cannot also build the app: goapp build app

can't load package: package app: cannot find package "app" in any of:
         ....
         ....

Try with GOPATH:

GOPATH=`pwd`/app goapp build

Not much sense as well

can't load package: package .: no buildable Go source files in /....

I also afraid that installing packages might be cumbersome unless I've discovered a right place to start them or configure GOPATH correctly. Any ideas on how it should look like for Google App Engine Go app?

答案1

得分: 2

将应用程序中的所有内容格式化:

  goapp fmt ./app/...

构建所有内容:

 goapp build ./app/...

我通常会切换到包含 app.yaml 的目录,这样我就可以执行以下操作:

 goapp serve
 goapp fmt ./... 

等等。

英文:

To format everything in the application:

  goapp fmt ./app/...

To build all:

 goapp build ./app/...

I usually cd to the directory containing app.yaml so that I can:

 goapp serve
 goapp fmt ./...

and so on.

huangapple
  • 本文由 发表于 2014年10月25日 04:26:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/26555755.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定