[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/5] gitignore: Ignore golang package directory




> On May 26, 2020, at 2:54 PM, Ian Jackson <ian.jackson@xxxxxxxxxx> wrote:
> 
> George Dunlap writes ("[PATCH 5/5] gitignore: Ignore golang package 
> directory"):
>> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
> 
> I have to say that finding a directory src/ in gitignore is very
> startling.
> 
> This directory src/ contains only output files ?

With golang, you don’t really distribute package binaries; you only distribute 
source files.

However, we don’t want to wait until someone tries to clone the package to see 
if we’ve broken the build; so the current makefile does a “build test” of the 
package files.

Before golang’s “modules” feature, the only way to do this was to have the code 
to build inside $GOPATH/src/$PACKAGENAME.  We can set GOPATH but we can’t 
change the “src” component of that.  So we used to set GOPATH to 
$XENROOT/tools/golang, put the files in $XENROOT/tools/golang/src/$PACKAGENAME, 
and 

With the “modules” feature, code can be built anywhere; the build at the moment 
doesn’t require GOPATH.

If we’re willing to limit ourselves to using versions of golang which support 
modules by default (1.12+), then we can probably get rid of this bit instead.  
(And if we do want to support older versions, we should really add some code in 
the configure script to determine whether to build with modules or GOPATH.)

Nick, any opinions?

> Is there not a risk that humans will try to edit it ?

I suppose someone might.  If we decide we want to support older versions of go, 
we probably want to figure something out there.  Options:

1. Copy the files to a temp directory instead.  This is complicated because we 
have to find a good temp directory, and we’d have to copy them every time, 
slowing down the incremental build (though not that much).

2. Put a file in the generated directory like “GENERATED_DO_NOT_EDIT”.

3. Put them in tools/golang/GENERATED_DO_NOT_EDIT/src instead.

 -George

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.