cli icon indicating copy to clipboard operation
cli copied to clipboard

cf push failed: cannot find package "github.com/gin-gonic/gin"

Open fanux opened this issue 10 years ago • 4 comments

First I install gin framework on my pc go get github.com/gin-gonic/gin then I open my $GOPATH directory and run godep save ./... copy the Godeps and vendor in my project home direcory edit manifest.yml :


---
applications:
        - name: fanuxhello
          memory: 256M
          instances: 1

edit Procfile:
web: fanuxhello

this is my main.go:

package main

import "github.com/gin-gonic/gin"
import "os"

func main() {
    r := gin.Default()
    r.GET("/", func(c *gin.Context) {
        c.JSON(200, gin.H{
            "message": "pong",
        })
    })

    r.Run(fmt.Sprintf(":%v", getPort()))
}

func getPort() string {
    if configuredPort := os.Getenv("PORT"); configuredPort == "" {
        return "3000"
    } else {
        return configuredPort
    }
}

finally run cf push:

2016-05-13T13:55:57.87+0800 [STG/0] ERR main.go:3:8: cannot find package "github.com/gin-gonic/gin" in any of: 2016-05-13T13:55:57.87+0800 [STG/0] ERR /tmp/cache/go1.6.2/go/src/github.com/gin-gonic/gin (from $GOROOT) 2016-05-13T13:55:57.87+0800 [STG/0] ERR /tmp/app/.heroku/go/src/github.com/gin-gonic/gin (from $GOPATH)

where I am wrong?

fanux avatar May 13 '16 06:05 fanux

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/119508841

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar May 13 '16 06:05 cf-gitbot

@fanux What does your Godeps/Godeps.json look like?

challiwill avatar May 23 '16 17:05 challiwill

$cat Godeps/Godeps.json 
{
    "ImportPath": "github.com/fanux/hello",
    "GoVersion": "go1.6",
    "GodepVersion": "v70",
    "Deps": [
        {
            "ImportPath": "github.com/gin-gonic/gin",
            "Comment": "v1.0rc1-266-g542be2f",
            "Rev": "542be2fe77724f800fcab7eb6c01a4e597fb8506"
        },
        {
            "ImportPath": "github.com/gin-gonic/gin/binding",
            "Comment": "v1.0rc1-266-g542be2f",
            "Rev": "542be2fe77724f800fcab7eb6c01a4e597fb8506"
        },
        {
            "ImportPath": "github.com/gin-gonic/gin/render",
            "Comment": "v1.0rc1-266-g542be2f",
            "Rev": "542be2fe77724f800fcab7eb6c01a4e597fb8506"
        },
        {
            "ImportPath": "github.com/golang/protobuf/proto",
            "Rev": "cd85f19845cc96cc6e5269c894d8cd3c67e9ed83"
        },
        {
            "ImportPath": "github.com/manucorporat/sse",
            "Rev": "ee05b128a739a0fb76c7ebd3ae4810c1de808d6d"
        },
        {
            "ImportPath": "golang.org/x/net/context",
            "Rev": "0c607074acd38c5f23d1344dfe74c977464d1257"
        },
        {
            "ImportPath": "gopkg.in/go-playground/validator.v8",
            "Comment": "v8.17.1",
            "Rev": "014792cf3e266caff1e916876be12282b33059e0"
        },
        {
            "ImportPath": "gopkg.in/yaml.v2",
            "Rev": "a83829b6f1293c91addabc89d0571c246397bbf4"
        }
    ]
}

@challiwill I am already sovle this problem, thank you very much.

fanux avatar May 26 '16 12:05 fanux

@fanux glad you got it working, for the future feel free to reach out to the buildpacks team directly ( https://github.com/cloudfoundry/go-buildpack ) with these kinds of issues.

We are closing this issue because it sounds like you've resolved it. If we've misunderstood feel free to re-open it.

n4wei avatar May 26 '16 17:05 n4wei