Closed JenneyJ closed 6 years ago
We have created an issue in Pivotal Tracker to manage this:
https://www.pivotaltracker.com/story/show/152713285
The labels on this github issue will be updated when the story is started.
@JenneyJ You need to set the environment variable GOPACKAGENAME to the package that this app is (eg. your git repo path : github.com/org/repo). If the package name doesn't matter, (for instance you only have a main package) then you can set that variable to anything you like.
@dgodd - I've only main package so i've tried(Mac) with export GOPACKAGENAME=""
and also with export GOPACKAGENAME mygoapp
and I got the same error .(not sure if importent - In the terminal I run those commads on the root project ) , ive only have package and main.go file...., any idea?
@JenneyJ Sorry I was ambiguous, you need to set GOPACKAGENAME on your app in CF. You could either use cf set-env
or more easily change your manifest.yml to
applications:
- name: go_app
buildpack: https://github.com/cloudfoundry/go-buildpack.git
memory: 256M
env:
GOPACKAGENAME: goapp
@dgodd - Thanks a lot ! Now that I've add the the env I dont get the previous error, now I got this error.
Download [https://buildpacks.cloudfoundry.org/dependencies/go/go1.8.5.linux-amd64-fe5c03fb.tar.gz]
-----> Running go build finalize
**WARNING** Installing package '.' (default)
main.go:6:2: cannot find package "github.com/gorilla/mux" in any of:
-----> Running: go install -tags cloudfoundry -buildmode pie .
/tmp/contents359235140/deps/0/go1.8.5/go/src/github.com/gorilla/mux (from $GOROOT)
/tmp/gobuildpack.gopath575791729/.go/src/github.com/gorilla/mux (from $GOPATH)
**ERROR** Unable to compile application: exit status 1
Exit status 223
Stopping instance 011200f7-z074-4aed-97b5-91235523c5b3
Failed to compile droplet: Failed to run finalize script: exit status 12
Destroying container
I've just create simple Go program as I write above and I use 'mux' ,any idea how to overcome this erorr, thanks!
You will need to either use one of the dependency managers (eg. dep) or use native vendoring (probably best done using a dependency tool like dep)
You can see an example dep project at: https://github.com/cloudfoundry/go-buildpack/tree/master/fixtures/go18_dep_vendored/src/go18_dep
A simple example of native vendoring at: https://github.com/cloudfoundry/go-buildpack/tree/master/fixtures/native_vendoring
@dgodd - ive installed the `dep' and now my program have in addition
vendor
Gopkg.lock
Gopkg.toml
but still i wasnt able to push it successfully to CF , now there is no error but the container crush... can you please check what can be wrong in this simple program ? why I cant simply push it to CF? Here is the program https://goo.gl/zxPLxE This is just some starting program which should be extended...
Thanks a lot!
Hi @JenneyJ
The problem with your app is that http.ListenAndServe
requires a ip:port
combo, not just a port. If you change
http.ListenAndServe(ports, nil)
to
if err := http.ListenAndServe(":"+ports, nil); err != nil {
panic(err)
}
all should work as you expect,
Closing as addressed.
HI,
I've tried to push very simple go application to cloud foundry and I got the following error
ive created this simple example which provide the same error, any idea?
When I push my app I use
cf push -b https://github.com/cloudfoundry/go-buildpack.git
the yaml is the following
Any idea what could be the problem ?