gin icon indicating copy to clipboard operation
gin copied to clipboard

Doesn't seem to work

Open pjebs opened this issue 10 years ago • 11 comments

In terminal: export PORT=3000 gin -h [gin] listening on port 0

I'm running the sample negroni code you have listening to port 3000

doesn't seem to work.

pjebs avatar Jun 09 '15 02:06 pjebs

Running into the same problem. It seems that https://github.com/codegangsta/cli/commit/65d50017d4f34772b8d767fb7478b9416b5d30c5 broke gin, the port flag isn't being set properly.

Temporary fix:

cd $GOPATH/src/github.com/codegangsta/cli
git checkout 4ee3fafcf # before the bad commit
go install github.com/codegangsta/gin

Bowbaq avatar Jun 15 '15 16:06 Bowbaq

Did you do a "git bisect" to determine that?

pjebs avatar Jun 15 '15 23:06 pjebs

No, it's just the last commit on context.go which is where the GlobalInt method used to get the port is. Reverting to the commit before it works. So I didn't really investigate further

Bowbaq avatar Jun 16 '15 14:06 Bowbaq

Having this issue as well -- thanks for the quick fix!

kylechadha avatar Jun 18 '15 19:06 kylechadha

I'm just using fresh instead

pjebs avatar Jun 18 '15 23:06 pjebs

I've got exactly the same problem in a docker container... I'm unable to make it running, and it won't use Godep as gopath. Note that we can't do such operation in golang container.

That could be nice if you make some release that we can use with gopkg.in

metal3d avatar Jun 28 '15 21:06 metal3d

An example:

patachou@patrice-laptop test2 (master)]$ ll
total 16
-rw-rw-r--. 1 patachou patachou  171 28 juin  23:44 docker-compose.yml
drwxrwxr-x. 3 patachou patachou 4096 28 juin  23:41 Godeps
-rw-rw-r--. 1 patachou patachou  201 28 juin  23:41 main.go
-rw-rw-r--. 1 patachou patachou   99 28 juin  23:37 Makefile
[patachou@patrice-laptop test2 (master)]$ cat docker-compose.yml 
test:
    image: golang
    command: make
    volumes:
    - .:/go/src/test2
    working_dir: /go/src/test2
    environment:
        PORT: 3000
    ports:
    - 3000:8080
[patachou@patrice-laptop test2 (master)]$ cat Makefile 
run:
    go get -u -v github.com/codegangsta/gin
    go get -u -v github.com/tools/godep
    gin -g -a 8080
[patachou@patrice-laptop test2 (master)]$ cat main.go 
package main

import (
    "net/http"
)

func TestF(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Coucou"))
}

func main() {
    http.HandleFunc("/", TestF)
    http.ListenAndServe(":8080", nil)
}
[patachou@patrice-laptop test2 (master)]$ docker-compose up
Recreating test2_test_1...
Attaching to test2_test_1
test_1 | go get -u -v github.com/codegangsta/gin
test_1 | github.com/codegangsta/gin (download)
test_1 | github.com/codegangsta/cli (download)
test_1 | github.com/codegangsta/envy (download)
test_1 | github.com/codegangsta/cli
test_1 | github.com/codegangsta/envy/lib
test_1 | github.com/codegangsta/gin/lib
test_1 | github.com/codegangsta/gin
test_1 | go get -u -v github.com/tools/godep
test_1 | github.com/tools/godep (download)
test_1 | github.com/kr/fs (download)
test_1 | github.com/pmezard/go-difflib (download)
test_1 | Fetching https://golang.org/x/tools/go/vcs?go-get=1
test_1 | Parsing meta tags from https://golang.org/x/tools/go/vcs?go-get=1 (status code 200)
test_1 | get "golang.org/x/tools/go/vcs": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/vcs?go-get=1
test_1 | get "golang.org/x/tools/go/vcs": verifying non-authoritative meta tag
test_1 | Fetching https://golang.org/x/tools?go-get=1
test_1 | Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
test_1 | golang.org/x/tools (download)
test_1 | github.com/kr/fs
test_1 | github.com/pmezard/go-difflib/difflib
test_1 | golang.org/x/tools/go/vcs
test_1 | github.com/tools/godep
test_1 | gin -g -a 8080
test_1 | [gin] listening on port 0

Golang 1.4.2

metal3d avatar Jun 29 '15 10:06 metal3d

https://github.com/pilu/fresh

pjebs avatar Jun 29 '15 11:06 pjebs

@pjebs thanks

frranck avatar Jun 29 '15 13:06 frranck

That's what I did. I use godep path command to change GOPATH and that works like a charm. Sad to quit gin... But fresh is cool

metal3d avatar Jun 29 '15 16:06 metal3d

@pjebs thank you

roma86 avatar Jun 24 '16 08:06 roma86