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
Message from discussion the go command

Date: Tue, 7 Feb 2012 14:09:55 -0800 (PST)
From: Stefan Nilsson <trolleriprofess...@gmail.com>
Reply-To: golang-nuts@googlegroups.com
To: golang-nuts@googlegroups.com
Message-ID: <26169397.2513.1328652595521.JavaMail.geo-discussion-forums@yqad38>
In-Reply-To: <CABT7-ZP_fQ1WHetj_gmxDpOhbYVMt1wYw_QL-nOHH=8aCC4uyQ@mail.gmail.com>
References: <CAAywNfcEQ+h8uNEjKvmWNti=8CLZ0kbFR-EZ8958+EBWqxjSWw@mail.gmail.com>
 <5985710.4108.1328639317142.JavaMail.geo-discussion-forums@vbue14>
 <CABT7-ZP_fQ1WHetj_gmxDpOhbYVMt1wYw_QL-nOHH=8aCC4uyQ@mail.gmail.com>
Subject: Re: [go-nuts] Re: the go command
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2511_31036207.1328652595514"

------=_Part_2511_31036207.1328652595514
Content-Type: multipart/alternative; 
	boundary="----=_Part_2512_8266883.1328652595520"

------=_Part_2512_8266883.1328652595520
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On Tuesday, February 7, 2012 8:51:30 PM UTC+1, Kyle Lemons wrote:
>
> If you put them in the same directory, it seems that you need to give the 
>> full path for x within the x_test package. That's inconvenient if you want 
>> to move your code.
>>
>
> The _test package is only intended to break dependency cycles incurred by 
> test code.  Since the _test files are ignored, they don't count as another 
> package normally, and go test understands them.
>

Let's say my package lives at  code.google.com/p/my-go-project/x. What's 
the best way to import this package from within a test package x_test 
living in the same directory? The following works (assuming you install the 
package at this path):

package x_test

import "code.google.com/p/my-go-project/x"

Is there, and should there be, some other way?

------=_Part_2512_8266883.1328652595520
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

On Tuesday, February 7, 2012 8:51:30 PM UTC+1, Kyle Lemons wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="text-align:left">If you put them in the same directory, it seems that you need to give the full path for x&nbsp;within the x_test package. That's inconvenient if you want to move your code.</div>

</blockquote></div><br><div>The _test package is only intended to break dependency cycles incurred by test code. &nbsp;Since the _test files are ignored, they don't count as another package normally, and go test understands them.</div></blockquote><div><br></div><div>Let's say my package lives at &nbsp;code.google.com/p/my-go-project/x. What's the best way to import this package from within a test package x_test living in the same directory? The following works (assuming you install the package at this path):</div><div><br></div><div><font face="'courier new', monospace">package x_test</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">import "code.google.com/p/my-go-project/x"</font></div><div><br></div><div>Is there, and should there be, some other way?</div>
------=_Part_2512_8266883.1328652595520--

------=_Part_2511_31036207.1328652595514--