Open taoma opened 6 years ago
I has stucked with this problem too.
And it works after I open page in browser: http://localhost:3000
$ go version
go version go1.11.1 linux/amd64
$ gin -v
gin version 0.0.0
Hmm.. I have found reason. Now I run command with -i
flag:
$ gin -i run main.go
And it works well:
$ gin -i run main.go
[gin] Listening on port 3000
[gin] Building...
[gin] Build finished
[GIN-debug] [WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /ping --> main.setupRouter.func1 (3 handlers)
[GIN-debug] GET /user/:name --> main.setupRouter.func2 (3 handlers)
[GIN-debug] POST /admin --> main.setupRouter.func3 (4 handlers)
[GIN-debug] Listening and serving HTTP on :8080
[GIN] 2018/10/04 - 15:54:04 | 200 | 135.256µs | ::1 | GET /user/test
[gin] Building...
[gin] Build finished
[GIN-debug] [WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /ping --> main.setupRouter.func1 (3 handlers)
[GIN-debug] GET /user/:name --> main.setupRouter.func2 (3 handlers)
[GIN-debug] POST /admin --> main.setupRouter.func3 (4 handlers)
[GIN-debug] Listening and serving HTTP on :8080
[GIN] 2018/10/04 - 15:54:09 | 200 | 94.992µs | ::1 | GET /user/test
About this option:
--immediate, -i run the server immediately after it's built
hotbuild.ffactory.org you can try it now.
See the following console output.
$ gin run main.go [gin] Listening on port 3000 [gin] Building... [gin] Build finished [DBUG] 2018/08/24 09:25 POST: /decode -> main.main.func1() [DBUG] 2018/08/24 09:25 GET: /encode -> main.main.func2() [DBUG] 2018/08/24 09:25 GET: /binary -> main.main.func3() [DBUG] 2018/08/24 09:25 GET: /text -> main.main.func4() [DBUG] 2018/08/24 09:25 GET: /json -> main.main.func5() [DBUG] 2018/08/24 09:25 GET: /jsonp -> main.main.func6() [DBUG] 2018/08/24 09:25 GET: /xml -> main.main.func7() [DBUG] 2018/08/24 09:25 GET: /markdown -> main.main.func8() [DBUG] 2018/08/24 09:25 Application: running using 1 host(s) [DBUG] 2018/08/24 09:25 Host: addr is :8080 [DBUG] 2018/08/24 09:25 Host: virtual host is localhost:8080 [DBUG] 2018/08/24 09:25 Host: register startup notifier [DBUG] 2018/08/24 09:25 Host: register server shutdown on interrupt(CTRL+C/CMD+C) [DBUG] 2018/08/24 09:25 Host: server will ignore the following errors: [http: Server closed] Now listening on: http://localhost:8080 Application started. Press CMD+C to shut down. 2018/08/24 09:25:49 http: proxy error: dial tcp [::1]:3001: connect: connection refused 2018/08/24 09:25:49 http: proxy error: dial tcp [::1]:3001: connect: connection refused [gin] Building... [gin] Build finished <-- after build, doesn't restart the host anymore. http://localhost:8080 gave 'This site can’t be reached' error [gin] Building... [gin] Build finished