gin
gin copied to clipboard
Doesn't seem to work
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.
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
Did you do a "git bisect" to determine that?
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
Having this issue as well -- thanks for the quick fix!
I'm just using fresh instead
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
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
https://github.com/pilu/fresh
@pjebs thanks
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
@pjebs thank you