Git Product home page Git Product logo

website's People

Contributors

3ks avatar alexanderchen1989 avatar appleboy avatar austinheap avatar chainhelen avatar cxjava avatar dlaub3 avatar easonlin404 avatar ganlvtech avatar javierprovecho avatar jiasir avatar justinbeckwith avatar konjoot avatar mantrax314 avatar manucorporat avatar mosdeo avatar msoedov avatar nazarepiedady avatar nl5887 avatar pinscript avatar rengotaku avatar sairoutine avatar sudo-suhas avatar then0b0dy avatar thinkerou avatar turingzhu avatar vinceyuan avatar wenjianzhang avatar willystadnick avatar wuxiangzhou2010 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

website's Issues

use go mod

use go mod, has an error:

/Users/liping/go/pkg/mod/github.com/gin-gonic/[email protected]/binding/msgpack.go:12:2: unknown import path "github.com/ugorji/go/codec": ambiguous import: found github.com/ugorji/go/codec in multiple modules:
github.com/ugorji/go v1.1.4 (/Users/liping/go/pkg/mod/github.com/ugorji/[email protected]/codec)
github.com/ugorji/go/codec v0.0.0-20180831062425-e253f1f20942 (/Users/liping/go/pkg/mod/github.com/ugorji/go/[email protected])

Documentation not found #readme-don-t-trust-all-proxies

hi, i'm new to golang and this framework.

I'm trying to run a starting template following document.
However, I encounter some warning :

[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.

I want to know more detail. So I follow into the document, but #readme-don-t-trust-all-proxies is nowhere to be found.
I know func (*Engine) SetTrustedProxies could possibly solve the warning. But I still wanna know why I should do it as "don-t-trust-all-proxies"?

ps: I tried google "don't trust all proxies" but nothing specific. And I'm a newbee and this is my first time making issue. Please feel free to correct me about anything.

Parameters in path

Router r.GET("/admin:MODE", HandleAdmin)
Hander mode := c.Param("MODE")

HTTP GET http://127.0.0.1:8088/v2d0/admin:offline
Result :offline
is BUG?

Testing is missing information

The testing example is only showing how to test the GET method, but there is not way to show how to do the POST and where can we send the body data!

Quickstart

I created the project in my workspace and make the build by using
~/go/src/hello1$ go build
-> and run the using below the commend
~/go/src/hello1$ ./hello1
-> It is working fie
[GIN-debug] Listening and serving HTTP on :8080
But I opened the new terminal and run the same means it is not working

hugo server error

os: windows 10
hugo version: 0.54.0

$ hugo server
Building sites … Total in 571 ms
Error: Error building site: "%root%\content\ja\_index.html:6:5": failed to extract shortcode: template for shortcode "blocks/cover" not found

Same error occured using

$ npm install
$ hugo

Am I missing any files?

Using middleware

In the Using Middleware Example the code shows a code block after the call to authorized.Use(AuthRequired()).

What is the purpose of putting the code inside its own block? The block seems to be unnecessary.

presenter e Gin

Estou tentando usar um presenter no Gin

Codigo :

func TestePresenter(ctx *gin.Context) {
//var toJ *presenter.TestePresenter
var entidade *entity.TesteEntity

toJ := &presenter.TestePresenter{
	Id:        entidade.Id,
	Descricao: entidade.Descricao,
}
ctx.Header("Content-Type", "application/json")
ctx.JSON(200, toJ)

}

package entity

type TesteEntity struct {
Id int
Descricao string
}

package presenter

type TestePresenter struct { //classe Presenter
Id int json:"iddddddddddddd"
Descricao string json:"descricaoooooooooooo"
}

Erro:

2020/07/13 12:44:23 [Recovery] 2020/07/13 - 12:44:23 panic recovered:
GET /testePresenter HTTP/1.1
Host: localhost:1339
Accept: /
Accept-Encoding: gzip, deflate, br
Cache-Control: no-cache
Connection: keep-alive
Postman-Token: c4e1f478-68db-4a46-aab8-fcfb11335c87
User-Agent: PostmanRuntime/7.26.1

runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:212 (0x44a9b9)
panicmem: panic(memoryError)
/usr/local/go/src/runtime/signal_unix.go:695 (0x44a808)
sigpanic: panicmem()
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/service/service.go:56 (0x9684dd)
TestePresenter: Id: entidade.Id,
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/vendor/github.com/gin-gonic/gin/context.go:161 (0x95343a)
(*Context).Next: c.handlersc.index
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/vendor/github.com/gin-gonic/gin/recovery.go:83 (0x966b3f)
RecoveryWithWriter.func1: c.Next()
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/vendor/github.com/gin-gonic/gin/context.go:161 (0x95343a)
(*Context).Next: c.handlersc.index
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/vendor/github.com/gin-gonic/gin/logger.go:241 (0x965c70)
LoggerWithConfig.func1: c.Next()
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/vendor/github.com/gin-gonic/gin/context.go:161 (0x95343a)
(*Context).Next: c.handlersc.index
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/vendor/github.com/gin-gonic/gin/gin.go:409 (0x95d215)
(*Engine).handleHTTPRequest: c.Next()
/home/marcos/Documentos/Projetos-ARQ3/dev-go-example/vendor/github.com/gin-gonic/gin/gin.go:367 (0x95c92c)
(*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/usr/local/go/src/net/http/server.go:2807 (0x6c77b2)
serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/local/go/src/net/http/server.go:1895 (0x6c312b)
(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/local/go/src/runtime/asm_amd64.s:1373 (0x464210)
goexit: BYTE $0x90 // NOP

Routes path

I need to create an endpoint in a group that returns me a list of the path of my application but I can't find the method that returns this information to me, the handlenames I've already found

*gin.Context.HandlerNames()

*gin.Context.HandlerRoutes()???????

JSONP

the code in https://gin-gonic.com/zh-cn/docs/examples/jsonp/
r.GET("/JSONP?callback=x", func(c *gin.Context) {
data := map[string]interface{}{
"foo": "bar",
}

// callback 是 x
// 将输出:x({\"foo\":\"bar\"})
c.JSONP(http.StatusOK, data)

})
need to be:
r.GET("/JSONP", func(c *gin.Context) {
data := map[string]interface{}{
"foo": "bar",
}

// callback 是 x
// 将输出:x({\"foo\":\"bar\"})
c.JSONP(http.StatusOK, data)

})

Quickstart

It says in Quickstart:

Go 1.7 or Go 1.8 will be no longer supported soon.

Is it a wrong expression?

如何记录日志

我是一个新手,刚学gin。
请问如何记录接口的入参和出参,这对于排查问题很有帮助。

Site down?

I tried loading the site multiple times today, but it says it's unavailable.

The first version Gin website have completed!

Hi, @javierprovecho @appleboy @isgj @dlaub3

As title and optimize later on.

Gin website build based on https://github.com/census-instrumentation/opencensus-website and not use git submodule but copy docdock theme.
Use docsy theme.

The feature https://gin-gonic.com/introduction/ come from https://gin-gonic.github.io/gin/, right?

TODO:

  • favicon svg and some image for Gin

  • improve document, because only have example code have not explain

  • improve directory, like: binding dir, rendering dir, middleware dir, and so on

  • optimize/update header nav / footer nav? update color?

  • Chinese translation dir

  • use git submodule?

  • add disqus?

Syntax Highlighting

It would be nice to use a theme with syntax highlighting. It makes reading code samples easier.

HTTP2 server 推送

生成了对应的key,pem,配置好了,但是说是不安全的,也同意继续了。
但是app.js并不是推送的,而是再次请求的,network两个请求。
看了一下命令行有错误输出,问下Failed to push: feature not supported这个问题怎么解决。
2023/04/11 22:50:18 Failed to push: feature not supported
[GIN] 2023/04/11 - 22:50:18 | 200 | 66.39µs | ::1 | GET "/"
[GIN] 2023/04/11 - 22:50:18 | 200 | 227.806µs | ::1 | GET "/assets/app.js"

In-depth documentation

I'm relatively new to Gin, and so far I love the framework.

My background is mostly based in PHP working with Laravel, and part of what makes Laravel so great to get started with is the documentation. I know that the Gin repository contains a very in-depth README, however, I feel that it would benefit the framework vastly by having an in-depth documentation for those who are new to the framework or those that are experienced to access.

This is something that I would personally be very happy to work on.

Documentation

the documentation doesnt describe any of the functions, classes or methods in it.
The only thing that the documentation gives you, is examples which you have to understand by yourself ehich isnt the point.
A documentation must be descriptive, clear, show every single aspect of the package WITH expamples which this one isnt doing.
The documentation is poorly written and unclear.
You should consider refactoring the documentation abt the framework

Testing page not describing tests clearly for more than one route

Situation:

The Testing is not clear enough when we need to test more than one route.

For instance, if we have multiple routes in our project, such as this

func setupRouter() *gin.Engine {
	router := gin.Default()
	router.GET("/albums", getAlbums)
	router.POST("/album", addAlbum)
	router.GET("/albums/:id", getAlbumById)
	return router
}

based on the documentation, how can we test all this routes and also avoid calling setupRouter for every test function? as I did in the project above

func TestGetAlbumsRoute(t *testing.T) {
	router := setupRouter()
	w := httptest.NewRecorder()
	req, _ := http.NewRequest("GET", "/albums", nil)
	router.ServeHTTP(w, req)

	assert.Equal(t, 200, w.Code)
	assert.Equal(t, "[{\"id\":\"1\",\"title\":\"Blue Train\",\"artist\":\"John Coltrane\",\"price\":56.99},{\"id\":\"2\",\"title\":\"Jeru\",\"artist\":\"Gerry Mulligan\",\"price\":17.99},{\"id\":\"3\",\"title\":\"Sarah Vaughan and Clifford Brown\",\"artist\":\"Sarah Vaughan\",\"price\":39.99}]", w.Body.String())
}

func TestGetAlbumById(t *testing.T) {
	router := setupRouter()
	w := httptest.NewRecorder()
	req, _ := http.NewRequest("GET", "/albums/2", nil)
	router.ServeHTTP(w, req)

	assert.Equal(t, 200, w.Code)
	assert.JSONEq(t, 
		"{\"id\":\"2\",\"title\":\"Jeru\",\"artist\":\"Gerry Mulligan\",\"price\":17.99}", 
		w.Body.String())
}

The documentation could have just the one example with multiple routes so this scenario would be more wide explained and help more code with basic apis.

HTML 渲染

I want to write template into bytes.Buffer,like

var tpl bytes.Buffer
	if err := t.Execute(&tpl, data); err != nil {
		log.Println(err)
		return
	}
	result := tpl.String()

i want write this use gin,how to do?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.