Re: Go Lang everything in a single source?

802 views
Skip to first unread message

Kyle Finley

unread,
Nov 3, 2012, 6:18:59 PM11/3/12
to google-a...@googlegroups.com
In Go -- files within the same directory should belong to the same package. So, both main.go and a.go should be the same package E.g. package script. This turns out to be a really nice feature because it allows you to break your packages into logical pieces with very little effort.

I would suggest structuring your app like:

c:\gae\app.yaml
c:\gae\a\http.go
c:\gae\a\model.go
c:\gae\main\http.go
c:\gae\main\model.go

Files in the main directory would begin with package main, and files in the a directory would begin with package a

Alternatively you could put both a and main directories in a scripts directory.


On Friday, November 2, 2012 10:25:54 PM UTC-5, Lawrence Mok wrote:
Hi guys,

I'm new to "Go"... I wonder how can I separate my source files into multiple files instead of needing to keep all code into one file?

I tried but it always return results like:

2012/11/03 11:15:39 go-app-builder: Failed parsing input: failed parsing dir script: found packages main (main.go) and a (a.go) in c:\gae\script

My files structure is:
c:\gae\app.yaml
c:\gae\script\a.go
c:\gae\script\main.go

Thanks,
Lawrence

Amy Unruh

unread,
Nov 3, 2012, 7:19:09 PM11/3/12
to google-a...@googlegroups.com
Lawrence,

You might also be interested in this group: https://groups.google.com/group/google-appengine-go 

 -Amy


On 3 November 2012 14:25, Lawrence Mok <lawr...@a4support.com> wrote:
Hi guys,

I'm new to "Go"... I wonder how can I separate my source files into multiple files instead of needing to keep all code into one file?

I tried but it always return results like:

2012/11/03 11:15:39 go-app-builder: Failed parsing input: failed parsing dir script: found packages main (main.go) and a (a.go) in c:\gae\script

My files structure is:
c:\gae\app.yaml
c:\gae\script\a.go
c:\gae\script\main.go

Thanks,
Lawrence

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/ecrGCOkw_IcJ.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

Lawrence Mok

unread,
Feb 4, 2013, 4:10:41 AM2/4/13
to google-a...@googlegroups.com, amyu+...@google.com
Thank you guys, I'm getting used to this language now.
Reply all
Reply to author
Forward
0 new messages