skelterjohn / go-gb Goto Github PK
View Code? Open in Web Editor NEWA(nother) tool to build go projects.
A(nother) tool to build go projects.
When a projects topology is reorganised, .a files may be left behind. These taint the build space and can block a build. Obviously this can be avoided by 'find . -name "*.a" -delete', but including that functionality in 'gb -N' would be nice.
Generated makefiles produce the error Makefile:41: *** missing separator. Stop.
on Go branch r60. I inspected things a little more.
$ tail Makefile
include $(GOROOT)/src/Make.cmd
# gb: copy to local install
$(GBROOT)/bin/$(TARG): $(TARG)
mkdir -p $(dir $@); cp -f $< $@
command: $(GBROOT)/bin/$(TARG)
# gb: local dependencies
$(TARG): $(GBROOT)/_obj/view.a
<<<<<<< local
$
Looks like an unhandled merge conflict or something.
GOPATH over-rides target declarations potentially resulting in build failure. An informative warning when this happens would be useful.
I would really like for there to be an optional config file that tells gb
to ignore a package subtree. I'll illustrate with an example. A project called go-mypkg with structure
go-mypkg/
|
|- README
|- ignore.gb
`- mypkg/
|
|- workspace.gb
|- mypkg.go
|- ....
|- openglutils/
| |
| `- ...
`- sdlutils/
|
`- ...
The file go-mypkg/ignore.gb could have contents
# Don't install "mypkg/openglutils" or "mypkg/sdlutils" subpackages by default.
mypkg/openglutils
mypkg/sdlutils
If my intentions were not clear from the example. The subpackages "mypkg/openglutils", and "mypkg/sdlutils" are presumably for some kind of easy/assisted integration of "mypkg" with go-opengl and go-sdl. But the programmer of the example doesn't want go-opengl and go-sdl be actual dependencies of "mypkg" because "mypkg" by itself is useful without OpenGL and SDL (the C libs) being installed at all. I hope this makes sense and sounds reasonable. I would really appreciate this feature. (And if it exists, I would like it to be more promenant in the documentation.)
It would be nice to be able to still be able to build these sub-packages by explicitly naming them in the command line. And, if a package being built depends on a package in ignore.gb, the best thing to do would probably be to override ignore.gb and build the package anyway.
Furthermore, it would be nice to be able to place these "ignore.gb" files rooted at any directory in the workspace tree. So, to continue the above example, the go-mypkg/ignore.gb could be moved to go-mypkg/ignore.gb (edit: go-mypkg/mypkg/ignore.gb) and it contents could be altered to
# Don't install "mypkg/openglutils" or "mypkg/sdlutils" subpackages by default.
openglutils
sdlutils
Please consider adding this feature. What go-gb does do is polished and awesome! But I really need a build tool that I can tell to stay out of certain directories.
if GOPATH=gopath1:gopath2
if pkg1 in gopath1 depends on pkg2 in gopath2
"gb pkg1" fails to build pkg2.
It would be nice to be able to pass custom flags to testing code.
For example, the equivalent of the follwoing would be nice
gb -t --logfile=test.log
files.go referenced in makefile but not included
Changes to the exec package break gb in runext: RunExternal and RunExternalDump. I've made what I think are reasonable changes to correct this, but cannot get gb to correctly build a previously function project.
I get
6g -o _go_.6 build.go deps.go gb.go goinstall.go make.go pkg.go gofmt.go runext.go util.go files.go usage.go cgo.go query.go genmake.go
gb.go:92: undefined: os.Create
gb.go:225: undefined: os.Create
pkg.go:412: not enough arguments in call to os.Open
pkg.go:760: undefined: os.Create
pkg.go:1103: undefined: os.Create
files.go:54: not enough arguments in call to os.Open
files.go:90: not enough arguments in call to os.Open
files.go:105: not enough arguments in call to os.Open
files.go:161: not enough arguments in call to os.Open
files.go:167: undefined: os.Create
files.go:167: too many errors
make: *** [_go_.6] Error 1
This is on Darwin with release.r56
When I run gb -t it runs tests, but not benchmarks. Could a feature be added such that it runs benchmarks with -t (or a new flag added)?
$ find .
.
./bench
./bench/my_test.go
./bench/main.go
$ cat bench/main.go
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
$ cat bench/my_test.go
package test
import (
"fmt"
"testing"
)
func Test001(t *testing.T) {
fmt.Println("Running test 001")
}
func Test002(t *testing.T) {
fmt.Println("Running test 002")
}
func Benchmark001(b *testing.B) {
fmt.Println("Running bench 001")
}
func Benchmark002(b *testing.B) {
fmt.Println("Running bench 002")
}
$ gb -t
(in bench) building cmd "bench"
(in bench) testing "bench"
Running test 001
Running test 002
PASS
Built 1 target
Many packages include a sub-dir of examples. Those should be built only from within that sub-dir. Would it make sense to create a file which tells gb, "Do not descend into this sub-dir"? Or maybe a positive file which lists the sub-dirs which should be searched. Or do you think it's better just to let the examples be built by default, as long as they are not installed?
I don't know what I want is even remotely possible with gb. But here is what I'm looking for:
my directory structure
src
|--- cmd
| |--- main.go
|--- pkg
|--- foo
| |--- file1.go
|--- bar
| |--- file2.go
My requirement is that I want to have file1.go and file2.go in same package. I have some reasons for this directory layout. I tried setting //target: mylib/all on both file1.go and file2.go but I get Duplicate Target error.
Am I missing something or this is not supported by gb? If not, is there a chance to support something like this in near future?
Other than this, gb works great.
Make install yields the following message:
6g -I ./_obj -o go.6 build.go cgo.go deps.go files.go gb.go genmake.go gentest.go gofmt.go goinstall.go make.go pkg.go query.go runext.go usage.go util.go
genmake.go:72: assignment count mismatch: 2 = 1
genmake.go:125: assignment count mismatch: 2 = 1
gentest.go:121: assignment count mismatch: 2 = 1
make: *** [go.6] Error 1
I have a Imac OSX 10.7.
Probably just needs a new weekly tag in Github.
gvm (https://github.com/moovweb/gvm) installs gb using goinstall so I was hoping you could fix a minor issue in the go.r60.3 tag. It seems this line https://github.com/skelterjohn/go-gb/blob/go.r60.3/gb/pkg.go#L986 is masking valid errors that would otherwise be returned.
go: release.r60.3
gb: go.r60.3
The result is 0 so automation software thinks that tests that don't compile are successful :(
Change:
err = os.RemoveAll(testdir)
To:
rm_err := os.RemoveAll(testdir)
if err == nil { err = rm_err }
We have a strange problem. gb works great from a sub-dir, but not the parent dir, where it builds out of order. I don't see anything in the parent dir which should cause a problem.
I can give you a test-case, but it requires doozer. Using the release (not latest) golang:
goinstall github.com/ha/doozer
git clone git://github.com/bketelsen/skynet.git
cd skynet
git checkout cdbcab72 # if tip moves
cd skynet/examples/GetWidgets
gb # This should succeed.
gb -c
cd .. # problem occurs in both root and examples dirs
gb
You'll see this:
mangoInitiator.go: 10: can't find import: myStartup
What are we doing wrong, John?
Signature changes to path/filepath Walk break code in pkg.go
Thanks for the tools.
pkg.go:26: can't find import: path/filepath
Here is the output of gb -s in a directory with many targets:
pkg "mongrel2" (up to date)
pkg "seven5/dsl" (up to date)
pkg "seven5" (up to date)
cmd "tune" in seven5/tune (up to date)
pkg "samples/echo_chat" (up to date)
cmd "webapp_start" in samples/echo_chat/webapp_start (up to date)
pkg "samples/better_chat" (up to date)
cmd "rock_on" in seven5/rock_on (up to date)
cmd "sample2" in mongrel2/sample2 (up to date)
cmd "sample1" in mongrel2/sample1 (up to date)
However if I go into the directory "samples/better_chat" (which is a target above) and run gb -s I get:
Running gb in workspace /Volumes/External/seven5dev
pkg "seven5/dsl" (up to date)
pkg "samples/better_chat" (up to date)
You can see from the first line that it is picking up my gb.cfg file which has:
workspace = ../..
The workspace feature of the gb.cfg would be absolutely great for my use of gb...
thanks
ian smith
There is something wrong since HG#7651 that breaks the go-gb build.
To reproduce: pull and update go source, build all.bash, and try to rebuild go-gb
Output of build:
6g -o go.6 build.go deps.go gb.go goinstall.go make.go pkg.go gofmt.go runext.go util.go files.go usage.go cgo.go query.go genmake.go
pkg.go:154: undefined: path.Walk
make: *** [go.6] Error 1
yebyen@jcurry:~/go-gb/gb$ make
8g -o go.8 build.go deps.go gb.go goinstall.go make.go pkg.go gofmt.go runext.go util.go files.go usage.go cgo.go query.go genmake.go
gb.go:92: undefined: os.Create
gb.go:225: undefined: os.Create
pkg.go:412: not enough arguments in call to os.Open
pkg.go:760: undefined: os.Create
pkg.go:1103: undefined: os.Create
files.go:54: not enough arguments in call to os.Open
files.go:90: not enough arguments in call to os.Open
files.go:105: not enough arguments in call to os.Open
files.go:161: not enough arguments in call to os.Open
files.go:167: undefined: os.Create
files.go:167: too many errors
make: *** [go.8] Error 1
what's new with go since release?
i saw advice to hg pull -u, i will try this... do you suppose it's worth blogging about changes in go since release?
When trying to run gb
on Darwin, I get this:
$ go get code.google.com/p/go-gb/gb
$ gb
panic: template: MakeCmd:35: unexpected bad character U+003D '=' in if
goroutine 1 [running]:
text/template.Must(0x0, 0x22083817c0, 0x20837c470, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/text/template/helper.go:23 +0x50
main.init()
/Users/flo/go/src/code.google.com/p/go-gb/gb/genmake.go:74 +0x647
$ uname -a
Darwin flombp 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64 i386 MacBookPro10,2 Darwin
$ go version
go version go1.4.2 darwin/amd64
Any idea?
When I run...
sudo -E goinstall go-gb.googlecode.com/hg/gb
The installation fails with the following messages
/bin/bash: === cd /usr/local/Cellar/go/r59/src/pkg/go-gb.googlecode.com/hg/gb; bash gomake -f- install
6g -I "/usr/local/Cellar/go/r59/pkg/darwin_amd64" -o _go_.6 build.go cgo.go deps.go files.go gb.go genmake.go gentest.go gofmt.go goinstall.go make.go pkg.go query.go runext.go usage.go util.go
genmake.go:38: cannot use "MakeCmd" (type string) as type template.FormatterMap in function argument
genmake.go:71: assignment count mismatch: 2 = 1
genmake.go:78: cannot use "MakePkg" (type string) as type template.FormatterMap in function argument
genmake.go:124: assignment count mismatch: 2 = 1
gentest.go:85: cannot use "testmain" (type string) as type template.FormatterMap in function argument
gentest.go:121: assignment count mismatch: 2 = 1
make: *** [_go_.6] Error 1
--- exit status 2
goinstall: go-gb.googlecode.com/hg/gb: install: running bash: exit status 2
Halp!
I have a directory structure [package names have been changed to protect the innocent]
./
mypkg/
mypkg.go
myextension/
myextension.go
examples/
pkg-example/
example.go
extension-example/
example.go
utils/
utils.go
When I run gb --workspace
(from the working directory ./
), workspace.gb files are created in all subdirectories except for examples/
. And, it makes building from examples/
impossible because the files examples/*-example/example.go
use the import path "examples/utils"
.
Please have gb
create these workspace.gb files.
Thanks in advance. The fact that it builds so easily at all is a wonder ;)
Cheers
for !HasPathPrefix(finish, start) {
backtracking = path.Join(backtracking, "..")
start, _ = path.Split(start)
start = path.Clean(start)
}
Stack trace (panic was just to display finish and start and stack trace)
panic: finish=C:\c\go\go-gb\example start=C:/c/go/gc
runtime.panic+0x99 /go/src/pkg/runtime/proc.c:1023
runtime.panic(0x485f60, 0x2e0700)
main.GetRelative+0x13a C:/c/go/go-gb/gb/util.go:94
main.GetRelative(0x2e22d0, 0xa, 0x36a740, 0x15, 0x0, ...)
main.ReadPackage+0x1c1 C:/c/go/go-gb/gb/pkg.go:92
main.ReadPackage(0x472050, 0x1, 0x472050, 0x1, 0x368240, ...)
main.ScanDirectory+0x1ae C:/c/go/go-gb/gb/gb.go:81
main.ScanDirectory(0x472050, 0x1, 0x472050, 0x1, 0x0, ...)
main.RunGB+0x168 C:/c/go/go-gb/gb/gb.go:350
main.RunGB(0x0, 0x0)
main.main+0x1e2 C:/c/go/go-gb/gb/gb.go:515
main.main()
runtime.mainstart+0xf 386/asm.s:85
runtime.mainstart()
runtime.goexit /go/src/pkg/runtime/proc.c:149
runtime.goexit()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.