Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Creating a library
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jeremy Villalobos  
View profile  
 More options Apr 27 2012, 4:01 pm
From: Jeremy Villalobos <jeremyvillalo...@gmail.com>
Date: Fri, 27 Apr 2012 16:01:57 -0400
Local: Fri, Apr 27 2012 4:01 pm
Subject: Creating a library

This may seem fairly obvious, but it is not in the documentation pages.

How do I manage packages on my own project ?  If I want to make a module
for some related services for example ?  The equivalent of creating a
package in Java ( com.my.company. )

How do I create a library for internal use ?

How do I compile multiple files ?

What is the standard makefile or ant script that is intended to be used by
go projects ?

Thank you.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyle Lemons  
View profile  
 More options Apr 27 2012, 4:05 pm
From: Kyle Lemons <kev...@google.com>
Date: Fri, 27 Apr 2012 13:05:15 -0700
Local: Fri, Apr 27 2012 4:05 pm
Subject: Re: [go-nuts] Creating a library

They're all packages in a GOPATH.  Whether you publish them on the web
makes them internal or not :).

Have you read How to Write Go Code http://golang.org/doc/code.html ?

On Fri, Apr 27, 2012 at 1:01 PM, Jeremy Villalobos <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason McVetta  
View profile  
 More options Apr 27 2012, 6:53 pm
From: Jason McVetta <jason.mcve...@gmail.com>
Date: Fri, 27 Apr 2012 15:53:37 -0700
Local: Fri, Apr 27 2012 6:53 pm
Subject: Re: [go-nuts] Creating a library

Your question seems similar to my recent question about code
layout<https://groups.google.com/d/topic/golang-nuts/mwLeVoNkvPw/discussion>.
 Let me try to answer with an example.  Suppose you want to create a
application 'politics' that depends on two of your libraries, 'corruption'
and 'greed'.  The app and both libraries live on github, each in its own
repository.  Your code layout would look like this:

$GOPATH/
    src/
        github.com/
            your_username/
                corruption/
                    .git/
                    corruption.go
                greed/
                    .git/
                    greed.go
                politics/
                    .git/
                    politics.go

Each folder under src/github.com/your_username/ is the root of a git
checkout.  Let's assume we are starting from scratch, and the repos for all
three packages have already been initialized on github.  Use the
"Initialize this repository with a README" option so your repos can be
cloned immediately.   You would create the project like this:

cd ~
mkdir mygo  # Go workspace
export GOPATH=~/mygo
cd $GOPATH
mkdir -p src/github.com/your_username
cd src/github.com/your_username
git clone g...@github.com:your_username/corruption.git
git clone g...@github.com:your_username/greed.git
git clone g...@github.com:your_username/politics.git

Create your greed & corruption libraries.  You would then import them into
politics.go like this:

import(
    "github.com/your_username/corruption"
    "github.com/your_username/greed"
)

During development you can build e.g. the greed library by itself with the
command "go build ...greed".  To compile the politics app and its
dependencies all together, you just need to give the command "go build
...politics".

On Fri, Apr 27, 2012 at 1:01 PM, Jeremy Villalobos <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »