It's unclear when you say "I have two other packages, example.go and 
user.go which contain the handler functions."

If these files are all in the same directory, then they are all be part of 
the *same* package.  For example, they'll all have "package main" as the 
first line.  Since you don't show the complete files, I can't see this, but 
that's how it should be.

Splitting functions and global variables between files in the same package 
is easy: you can move them around at will, since they're all part of the 
same package namespace.  The only changes you'll need to make is to ensure 
the "import" statements at the top of each source file import any external 
packages used by the code in that source file.

If you want to make separate packages, then each package has to be in its 
own subdirectory.  But since you didn't mention directories, I don't think 
this is what you're doing.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6f86e51c-1258-491f-bb57-84bce2edb7e3n%40googlegroups.com.

Reply via email to