Export to GitHub

godag - issue #5

Multi-main projects compile a wrong way


Posted on Nov 27, 2011 by Massive Hippo

What steps will reproduce the problem? 1. Have a project like this one: {{{ > tree go/src/ go/src/ |-- foo | -- main.go -- bar `-- main.go }}} 2. Try to compile with godag

What is the expected output? Since both foo/main.go and bar/main.go belong to package main, they sould be compiled and linked onto bin/foo and bin/bar, respectively (just the gb behavior).

What do you see instead? Foo and bar are compiled as if they belonged to packages instead of commands, i.e. are compiled onto _obj/foo.6 and _obj/bar.6

What version of the product are you using? On what operating system? I'm using godag weekly (git) under amd64 linux.

Comment #1

Posted on Nov 27, 2011 by Swift Cat

that can be done, godag only has a 'regexp' way to select main packages to link, but this could overcome the problem of linking multiple main packages..

i'll try to add something, and you can see if it does the job. hopefully i'll update the right branch :-)

Comment #2

Posted on Nov 29, 2011 by Swift Cat

(No comment was entered for this change.)

Comment #3

Posted on Nov 29, 2011 by Swift Cat

(No comment was entered for this change.)

Comment #4

Posted on Dec 2, 2011 by Swift Cat

this sort of works now, but all the code related to linking needs to be rewritten, since it is not done in parallel. it also uses "regular expressions" which could match more than one main package as well which is less than ideal, so it's not a complete fix :-)

bjarneh

Status: Started

Labels:
Type-Defect Priority-Medium