Error response: [2] Build failed using GCP - Golang - go

I'm trying deploy my server using Golang into Google Cloud Platform
I run gcloud app deploy cmd/web/app.yaml
And was return Failure status: UNKNOWN: Error Response: [2] Build failed; check build logs for details
Into the logs was print this:
Starting Step #0
Step #0: Pulling image: gcr.io/gcp-runtimes/go1-builder#sha256:[...]
Step #0: sha256:[...]: Pulling from gcp-runtimes/go1-builder
Step #0: Digest: sha256:[...]
Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/go1-builder#sha256:[...]
Step #0: main.go:8:2: cannot find package "github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql" in any of:
Step #0: /usr/local/go/src/github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql (from $GOROOT)
Step #0: /workspace/_gopath/src/github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql (from $GOPATH)
Step #0: routes.go:5:2: cannot find package "github.com/bmizerany/pat" in any of:
Step #0: /usr/local/go/src/github.com/bmizerany/pat (from $GOROOT)
Step #0: /workspace/_gopath/src/github.com/bmizerany/pat (from $GOPATH)
Step #0: main.go:7:2: cannot find package "github.com/go-sql-driver/mysql" in any of:
Step #0: /usr/local/go/src/github.com/go-sql-driver/mysql (from $GOROOT)
Step #0: /workspace/_gopath/src/github.com/go-sql-driver/mysql (from $GOPATH)
Step #0: middleware.go:6:2: cannot find package "github.com/justinas/nosurf" in any of:
Step #0: /usr/local/go/src/github.com/justinas/nosurf (from $GOROOT)
Step #0: /workspace/_gopath/src/github.com/justinas/nosurf (from $GOPATH)
Step #0: handlers.go:7:2: cannot find package "myProject/pkg/forms" in any of:
Step #0: /usr/local/go/src/myProject/pkg/forms (from $GOROOT)
Step #0: /workspace/_gopath/src/myProject/pkg/forms (from $GOPATH)
Step #0: app.go:4:2: cannot find package "myProject/pkg/models" in any of:
Step #0: /usr/local/go/src/myProject/pkg/models (from $GOROOT)
Step #0: /workspace/_gopath/src/myProject/pkg/models (from $GOPATH)
Finished Step #0
ERROR
My gcloud configuration is correct because I have a connection to Google SQL and I save the data. I have the code in a Compute Engine, but I try to run gcloud app deploy cmd / web / app.yaml on my pc

External packages need to be local for the build to take place. Go programs are often comprised of packages from many different sources. Each one of these sources are pulled in from the GOPATH or from the standard library. (Source of Explanation)
Take a look at govendor. Govendor will create your vendor folder and add your external packages.
// init govendor
govendor init
# Add existing GOPATH files to vendor.
govendor add +external

The error was in app.yaml i don't have much idea why but i just delete into app.yaml the line api_version: go1

Related

How to compile gomuks on Ubuntu?

Trying to compile gomuks, following its insallation instructions, I get this error:
$ go install
gomuks.go:25:2: cannot find package "maunium.net/go/gomuks/config" in any of:
/usr/lib/go-1.10/src/maunium.net/go/gomuks/config (from $GOROOT)
/home/ettinger/go/src/maunium.net/go/gomuks/config (from $GOPATH)
gomuks.go:26:2: cannot find package "maunium.net/go/gomuks/debug" in any of:
/usr/lib/go-1.10/src/maunium.net/go/gomuks/debug (from $GOROOT)
/home/ettinger/go/src/maunium.net/go/gomuks/debug (from $GOPATH)
gomuks.go:27:2: cannot find package "maunium.net/go/gomuks/interface" in any of:
/usr/lib/go-1.10/src/maunium.net/go/gomuks/interface (from $GOROOT)
/home/ettinger/go/src/maunium.net/go/gomuks/interface (from $GOPATH)
gomuks.go:28:2: cannot find package "maunium.net/go/gomuks/matrix" in any of:
/usr/lib/go-1.10/src/maunium.net/go/gomuks/matrix (from $GOROOT)
/home/ettinger/go/src/maunium.net/go/gomuks/matrix (from $GOPATH)
main.go:30:2: cannot find package "maunium.net/go/gomuks/ui" in any of:
/usr/lib/go-1.10/src/maunium.net/go/gomuks/ui (from $GOROOT)
/home/ettinger/go/src/maunium.net/go/gomuks/ui (from $GOPATH)
What is the reason, how to solve it?
This repo uses Go modules feature and installation instructions clearly state it requires Go 1.13 or higher:
Install Go 1.13 or higher
From error messages it seems you have Go 1.10 which doesn't support modules (and likely also other features this repo depends on).
This error is caused by fact that prior modules support was added to Go in version 1.11; go tool was always looking up modules in $GOROOT and $GOPATH locations - and in your case it can't find them there.
Install Go 1.13 or higher to make the installation guide work. You can find recent enough packages in backport PPA or install latest from official tarball available here.

How to read stix data from hail a taxii

Want to read stix data from http://hailataxii.com/ but not getting the idea to get that!!
For how to connect they have provided not much info and haven't found any documentation regarding it. Thought of using freetaxiiserver (Go package) getting an error while installing it. https://github.com/freetaxii/server#freetaxiiserver
go get -u -v github.com/freetaxii/server/cmd/freetaxii
cd github.com/freetaxii/server/cmd/freetaxii
Error
1] for first command
package github.com/freetaxii/libstix2/resources/collections: cannot find package "github.com/freetaxii/libstix2/resources/collections" in any of:
/usr/local/go/src/github.com/freetaxii/libstix2/resources/collections (from $GOROOT)
/home/rohith/go/src/github.com/freetaxii/libstix2/resources/collections (from $GOPATH)
package github.com/freetaxii/libstix2/objects/baseobject: cannot find package "github.com/freetaxii/libstix2/objects/baseobject" in any of:
/usr/local/go/src/github.com/freetaxii/libstix2/objects/baseobject (from $GOROOT)
/home/rohith/go/src/github.com/freetaxii/libstix2/objects/baseobject (from $GOPATH)
2] for the second command
bash: cd: github.com/freetaxii/server/cmd/freetaxii: No such file or directory
have installed its required dependency.
Is there any way to read data hailTaxii or if I get documentation will be helpfull.

can't find attrmgr (from $GOROOT) and $GOPATH?

I am trying to install chaincode. I used cid package inside my chaincode When I try to install chaincode, I got the following error:
cannot load package:
package github.com/hyperledger/fabric/core/chaincode/lib/cid: cannot find package "github.com/hyperledger/fabric/core/chaincode/lib/cid" in any of:
/opt/go/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOROOT)
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOPATH)
I have used glide tool( here https://github.com/Masterminds/glide) to fix it,
now i see another error that I couldn't fix which is:
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "chaincode/input/src/github.com/chaincode/vendor/github.com/hyperledger/fabric/core/chaincode/lib/cid/cid.go:29:2: cannot find package "github.com/hyperledger/fabric/common/attrmgr" in any of:
/chaincode/input/src/github.com/chaincode/vendor/github.com/hyperledger/fabric/vendor/github.com/hyperledger/fabric/common/attrmgr (vendor tree)
/chaincode/input/src/github.com/chaincode/vendor/github.com/hyperledger/fabric/common/attrmgr
/opt/go/src/github.com/hyperledger/fabric/common/attrmgr (from $GOROOT)
/chaincode/input/src/github.com/hyperledger/fabric/common/attrmgr (from $GOPATH)
/opt/gopath/src/github.com/hyperledger/fabric/common/attrmgr
Any suggestion؟
Install the fabric dependency in your GOPATH, go get -u github.com/hyperledger/fabric

go install command with glide on windows

I'm having trouble running the go install $(glide nv) command.
I run this command from within my project's folder within the src folder of the go workspace directoy
so basically I do :
%GOPATH%/src/my/project/ go install $(glide nv)
The error message I get is as follow :
can't load package: package $(glide: cannot find package "$(glide" in any of:
C:\Go\src\$(glide (from $GOROOT)
W:\GO_WORKSPACE\src\$(glide (from $GOPATH)
can't load package: package nv): cannot find package "nv)" in any of:
C:\Go\src\nv) (from $GOROOT)
W:\GO_WORKSPACE\src\nv) (from $GOPATH)
I had previously run glide install without a problem on that project.
What am I missing?
It works on powershell. At the project directory run command:
go install $(glide nv)

install goose for golang and heroku

I've tried 2 methods to include goose to my golang project and it fails during the heroku build. I first tried this method: https://bitbucket.org/liamstask/goose/
I added 2 packages to the vendor.json file:
{
"checksumSHA1": "rmNwGgFJAcDxUGF5yB/zqhQPxCA=",
"path": "bitbucket.org/liamstask/goose/cmd/goose",
"revision": "8488cc47d90c8a502b1c41a462a6d9cc8ee0a895",
"revisionTime": "2015-01-15T23:40:39Z"
},
{
"checksumSHA1": "jdqLDQw64kBjkU7LPK7C+Qwj7W8=",
"path": "bitbucket.org/liamstask/goose/lib/goose",
"revision": "8488cc47d90c8a502b1c41a462a6d9cc8ee0a895",
"revisionTime": "2015-01-15T23:40:39Z"
}
and got the error:
can't load package: package bitbucket.org/liamstask/goose/cmd/goose: cannot find package "bitbucket.org/liamstask/goose/cmd/goose" in any of:
/app/tmp/cache/go1.7.5/go/src/bitbucket.org/liamstask/goose/cmd/goose (from $GOROOT)
/tmp/tmp.Pqgwxz8KyN/.go/src/bitbucket.org/liamstask/goose/cmd/goose (from $GOPATH)
! Push rejected, failed to compile Go app.
I then found these directions: https://bitbucket.org/liamstask/goose/issues/55/heroku-instructions-no-longer-works-on-go
and tried updating my vendor file to include:
"install": [
"./...",
"bitbucket.org/liamstask/goose/cmd/goose"
]
I'm still getting the same error message above. Any thoughts?
edit: Here's the full error message:
-----> Go app detected
-----> Checking vendor/vendor.json file.
-----> Using go1.7.5
-----> Fetching any unsaved dependencies (govendor sync)
-----> Running: go install -v -tags heroku ./... vendor/bitbucket.org/liamstask/goose/‌​cmd/goose
can't load package: package vendor/bitbucket.org/liamstask/goose/‌​cmd/goose: cannot find package "vendor/bitbucket.org/liamstask/goose/\u200c\u200bcmd/goose" in any of:
/app/tmp/cache/go1.7.5/go/src/vendor/bitbucket.org/liamstask/goose/‌​cmd/goose (from $GOROOT)
/tmp/tmp.IJd3qxVYqW/.go/src/vendor/bitbucket.org/liamstask/goose/‌​cmd/goose (from $GOPATH)
! Push rejected, failed to compile Go app.
! Push failed

Resources