cli icon indicating copy to clipboard operation
cli copied to clipboard

./bin/build fails

Open dodev opened this issue 11 years ago • 14 comments

I followed the steps here: https://github.com/cloudfoundry/cli#building

But the build fails:

Generating Binary...
 Generating i18n Resource file
flag provided but not defined: -ignore
Usage: go-bindata [options] <input directories>

I removed -ignore ".go" from https://github.com/cloudfoundry/cli/blob/master/bin/generate-language-resources#L8 and it worked.

It looks like go-bindata changed it's CLI.

dodev avatar Sep 26 '15 15:09 dodev

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/104235390.

cf-gitbot avatar Sep 26 '15 15:09 cf-gitbot

Can you post the output of go-bindata -version, please?

camelpunch avatar Sep 28 '15 15:09 camelpunch

Hi! Off course:

$ go-bindata --version
go-bindata 3.1.0 (Go runtime go1.2).
Copyright (c) 2010-2013, Jim Teeuwen.

dodev avatar Sep 29 '15 08:09 dodev

@dodev: I am also running v3.1.0, and -ignore is a valid flag. Maybe try reinstalling go-bindata?

$ go-bindata -h
Usage: go-bindata [options] <input directories>
  -debug=false: Do not embed the assets, but provide the embedding API. Contents will still be loaded from disk.
  -dev=false: Similar to debug, but does not emit absolute paths. Expects a rootDir variable to already exist in the generated code's package.
  -ignore=: Regex pattern to ignore
  -mode=0: Optional file mode override for all files.
  -modtime=0: Optional modification unix timestamp override for all files.
  -nocompress=false: Assets will *not* be GZIP compressed when this flag is specified.
  -nomemcopy=false: Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.
  -nometadata=false: Assets will not preserve size, mode, and modtime info.
  -o="./bindata.go": Optional name of the output file to be generated.
  -pkg="main": Package name to use in the generated code.
  -prefix="": Optional path prefix to strip off asset names.
  -tags="": Optional set of build tags to include.
  -version=false: Displays version information.
$ go-bindata -version
go-bindata 3.1.0 (Go runtime go1.4.2).
Copyright (c) 2010-2013, Jim Teeuwen.

simonleung8 avatar Sep 29 '15 14:09 simonleung8

The difference looks to be the version of golang: @dodev is running 1.2, and @simonleung8 is running 1.4.2. Trying using 1.4.2?

camelpunch avatar Sep 29 '15 14:09 camelpunch

I should have stated this, but I also tried running it in go v.1.2.2 and the -ignore flag is still valid

simonleung8 avatar Sep 29 '15 15:09 simonleung8

Maybe it's because I'm running it on linux (debian/stable)?

dodev avatar Oct 05 '15 12:10 dodev

@dodev I've just run this on an Ubuntu machine without hiccups. Could you please post the output of go-bindata -h?

camelpunch avatar Oct 28 '15 09:10 camelpunch

Hi, I still don't have -ignore flag:

dodev@dodev-nb-linux ~/source/gocode $ go-bindata -h
Usage: go-bindata [options] <input directories>

  -debug=false: Do not embed the assets, but provide the embedding API. Contents will still be loaded from disk.
  -nocompress=false: Assets will *not* be GZIP compressed when this flag is specified.
  -nomemcopy=false: Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.
  -o="./bindata.go": Optional name of the output file to be generated.
  -pkg="main": Package name to use in the generated code.
  -prefix="": Optional path prefix to strip off asset names.
  -tags="": Optional set of uild tags to include.
  -version=false: Displays version information.

I updated the go-bindata source and then rebuilt it, but still no -ignore flag in the cli. Very strange.

BTW, I used the following command to get go-bindata: go get github.com/jteeuwen/go-bindata/..., like it's suggested in cloudfoundry/cli/README.md

dodev avatar Oct 28 '15 11:10 dodev

Can you git show inside go-bindata please?

camelpunch avatar Oct 28 '15 11:10 camelpunch

$ git show
commit a0ff2567cfb70903282db057e799fd826784d41d
Merge: bfe36d3 8ed2cd0
Author: Jim Teeuwen <[email protected]>
Date:   Fri Oct 23 11:11:02 2015 +0200

    Merge pull request #115 from grobie/fix-go-fmt

    Fix go format of generated code

dodev avatar Oct 29 '15 11:10 dodev

Part of the problem with go-bindata is that -version has had the same output for a long time. Here's when -ignore arrived: https://github.com/jteeuwen/go-bindata/commit/7f6fddddd093fa329c7b5441c38b4d9d2ef87472

As you can tell, that is tagged as early as v3.06. At v3.06, guess what -version gave?

https://github.com/jteeuwen/go-bindata/blob/v3.0.6/go-bindata/version.go

So getting your -version to determine what version you have turned out to be pointless.

Can you do:

mv $GOPATH/bin/go-bindata{,.old}
cd $GOPATH/src/github.com/jteeuwen/go-bindata
go install ./...
go-bindata

...and see if that last invocation has the full command set?

camelpunch avatar Nov 02 '15 15:11 camelpunch

OK, I figured it out. It was an issues with my go environment configuration. So I tried what @camelpunch suggested and still got the old command set. I did a git log in jtweeuwen/go-bindata and the commit which added support for -ignore was there. So I did a manual build in the same directory go build -o gobd go-bindata/*. As a result I got a binary file, which when called with --help showed the new command set:

$ ./gobd --help
Usage: ./gobd [options] <input directories>

  -debug=false: Do not embed the assets, but provide the embedding API. Contents will still be loaded from disk.
  -dev=false: Similar to debug, but does not emit absolute paths. Expects a rootDir variable to already exist in the generated code's package.
  -ignore=: Regex pattern to ignore
...

I thought that this is very weird. How come go install build a version of go-bindata that is pre-2014. So I checked the executable I was working with globally:

dodev@dodev-nb-linux ~ $ which go-bindata 
/usr/bin/go-bindata
dodev@dodev-nb-linux ~ $ dpkg -s go-bindata 
Package: go-bindata
Status: install ok installed
Priority: extra
Section: devel
Installed-Size: 2328
Maintainer: Debian Go Packaging Team <[email protected]>
Architecture: amd64
Source: golang-bindata
Version: 3.0.5-1
....

So I checked my go environment configuration and there it was:

export PATH=$PATH:$GOPATH/bin

The global path overrides my locally build executables. I just switched the places of the local and global path and the script cloudfoundry/cli/bin/build worked like a charm.

I did my go environment configuration by the go lang's Getting Started Guide and I used the golang packages provided with debian stable.

I hope this thread helps solving future problems with building the cf executable on debian machines.

dodev avatar Nov 03 '15 13:11 dodev

Thanks for sharing!

dkoper avatar Nov 04 '15 22:11 dkoper